[ ghc-Bugs-1285326 ] scavenge_one: strange object 47

2005-09-13 Thread SourceForge.net
Bugs item #1285326, was opened at 2005-09-08 20:18
Message generated for change (Comment added) made by simonmar
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1285326group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: tuananhbirm (tuananhbirm)
Assigned to: Nobody/Anonymous (nobody)
Summary: scavenge_one: strange object 47

Initial Comment:

Hi, i am running GHC 6.4, in Redhat 9, running
sometimes with flag -threaded on.


Please look at the file Mult.hs

and function: startM1 (17-20)

run this function for different inputs (orignially,
multiply (1%7) with (0%2)) try to run with : (1%3) and
(0%1)
  (2%3) and (0%1)
  (1%2) and (0%1)
  (1%5) and (0%1)


Best regards
TuanAnh



--

Comment By: Simon Marlow (simonmar)
Date: 2005-09-13 08:47

Message:
Logged In: YES 
user_id=48280

After fixing the bug, I ran the test program for about
30mins and it still hadn't finished.  Is there a way to run
it for, say, 5 seconds?

The fix will be in version 6.4.1.

--

Comment By: tuananhbirm (tuananhbirm)
Date: 2005-09-12 18:23

Message:
Logged In: YES 
user_id=1341750

 what do you mean by allow it to run for a shorter time ? 

btw, how do i use the fixed version of ghc ? (is there a
patch for this bug or something similar ? )

Thanks a lot
TuanAnh


--

Comment By: Simon Marlow (simonmar)
Date: 2005-09-12 15:56

Message:
Logged In: YES 
user_id=48280

Fixed now, thanks for a good report.

I'd like to use this as a test case - how can I provide
inputs that allow it to run for a shorter time?

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1285326group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1277825 ] segmentation fault when profiling large case

2005-09-13 Thread SourceForge.net
Bugs item #1277825, was opened at 2005-09-01 00:31
Message generated for change (Comment added) made by simonmar
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1277825group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Profiling
Group: 6.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: segmentation fault when profiling large case

Initial Comment:
If the attached file is compiled with -prof -auto-all,
the binary produced will segfault (even if RTS
profiling options are not present).  This seems to be
caused by a combination of a case statement with a
large number of branches and a relatively complex value
at the end of each branch - reducing the number of
branches by one or changing any of the data
declarations to newtypes eliminates the segfault.

--

Comment By: Simon Marlow (simonmar)
Date: 2005-09-13 08:51

Message:
Logged In: YES 
user_id=48280

Fergus - are you the original submitter?

What was different about the environment in which the bug
exhibits?

--

Comment By: Fergus Henderson (fergus)
Date: 2005-09-05 21:48

Message:
Logged In: YES 
user_id=135331

I tried reproducing this using ghc 6.4 on Debian Linux,
but I was unable to reproduce the bug.  The program compiled
fine with ghc -prof -auto-all bug.hs and I was able to get
a profile
by running ./a.out +RTS -p and looking at a.out.prof.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1277825group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1282571 ] +RTS -xc and SIGINT handler gives seg fault

2005-09-13 Thread SourceForge.net
Bugs item #1282571, was opened at 2005-09-05 22:33
Message generated for change (Comment added) made by simonmar
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1282571group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Profiling
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Fergus Henderson (fergus)
Assigned to: Nobody/Anonymous (nobody)
Summary: +RTS -xc and SIGINT handler gives seg fault

Initial Comment:
To reproduce this bug, save the attached file Bug.hs, 
run the following commands

  ghc -package posix -prof -auto-all Bug.hs
  ./a.out +RTS -xc

and then hit control-C.  The result is a SIGSEGV inside
fprintCCS().


--

Comment By: Simon Marlow (simonmar)
Date: 2005-09-13 08:57

Message:
Logged In: YES 
user_id=48280

This one has been fixed in 6.4.1 (out soon).

--

Comment By: Fergus Henderson (fergus)
Date: 2005-09-05 22:44

Message:
Logged In: YES 
user_id=135331

The crash is a null pointer dereference in fprintCCS().
Here's a gdb stack trace

(gdb) where
#0  0x08072cbf in fprintCCS ()
#1  0x in ?? ()
#2  0x08077fa1 in raiseAsyncWithLock ()
#3  0x402b60f0 in ?? ()
#4  0x0809f3e8 in MainCapability ()
#5  0x402c2014 in ?? ()
#6  0x0807b2d2 in raisezh_fast ()
#7  0x401a3440 in _IO_2_1_stdout_ () from /lib/libc.so.6
#8  0x0809f174 in hp_file ()
#9  0x402c2024 in ?? ()
#10 0x in ?? ()
#11 0x0001 in ?? ()
#12 0x402c2024 in ?? ()
#13 0x0002 in ?? ()
#14 0x in ?? ()
#15 0x001c in ?? ()
#16 0x08099314 in Main_CAFs_cc ()
#17 0x01db846e in ?? ()
#18 0x08099334 in Main_CAFs_cc_ccs ()

The crash occurs at fprintCCS+44:
0x08072c93 fprintCCS+0:   push   %esi
0x08072c94 fprintCCS+1:   push   %ebx
0x08072c95 fprintCCS+2:   sub$0x14,%esp
0x08072c98 fprintCCS+5:   mov0x20(%esp),%esi
0x08072c9c fprintCCS+9:   mov0x24(%esp),%ebx
0x08072ca0 fprintCCS+13:  mov%esi,0x4(%esp)
0x08072ca4 fprintCCS+17:  movl   $0x3c,(%esp)
0x08072cab fprintCCS+24:  call   0x80492c8 _init+712
0x08072cb0 fprintCCS+29:  test   %ebx,%ebx
0x08072cb2 fprintCCS+31:  je 0x8072d0e fprintCCS+123
0x08072cb4 fprintCCS+33:  cmp$0x809d100,%ebx
0x08072cba fprintCCS+39:  je 0x8072d0e fprintCCS+123
0x08072cbc fprintCCS+41:  mov0x4(%ebx),%eax
0x08072cbf fprintCCS+44:  mov0x4(%eax),%eax

eax is zero.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1282571group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: memory allocation failed

2005-09-13 Thread Simon Marlow
On 09 September 2005 15:40, David F. Place wrote:

 My program terminated with the following message:
 
 pal: internal error: memory allocation failed (requested 2097152
  bytes) Please report this as a bug to
 glasgow-haskell-bugs@haskell.org, 

Forgive me for asking the obvious, but is it possible that you ran out
of memory?

If not, then yes we'd like to see your test case please.

Cheers,
Simon
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: ghc-6.4.1.20050903 (and maybe newer versions?) doesn't support--exec-prefix different from --prefix

2005-09-13 Thread Simon Marlow
On 10 September 2005 01:33, Frederik Eaton wrote:

 It seems ghc-6.4.1.20050903 doesn't support having an --exec-prefix
 different from --prefix. When I tried this, ghci didn't work, it was
 looking for libraries in PREFIX/lib which had been installed under
 EXEC_PREFIX/lib.

That's entirely possible.

Cheers,
Simon
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: problems building ghc 6.4.1_pre using 6.4 with multiplecabalversions installed

2005-09-13 Thread Simon Marlow
Just glancing over the patch, I can't immediately see how it works.  GHC
6.4 gives priority to package modules over modules on the local search
path, so Distribution.* will be taken from the installed Cabal package.
However, when linking GHC you are ommitting -package Cabal, so I'd
expect a link error.

Hmm, I guess I should try this and figure out what's happening.

Cheers,
Simon

On 12 September 2005 15:53, Duncan Coutts wrote:

 On Mon, 2005-09-12 at 13:33 +0100, Simon Marlow wrote:
 Quite right this is a problem, and it looks like something we should
 fix before 6.4.1.  I'll give it some thought.
 
 Hi Simon, glad to have you back! :-)
 
 Andres Loeh has looked into this a bit in the last few days. He's
 knocked up this patch which we're using in our Gentoo ebuilds for
 recent ghc-6.4.1 snapshots (2005/08/19 and 2005/09/09):
 

http://haskell.org/~gentoo/gentoo-haskell/portage/dev-lang/ghc/files/ghc
-6.4.1-nocabal.patch
 
 The patch is to make it build without using any existing installation
 of Cabal. So it'll work if there is no Cabal, 1 cabal or 2+ Cabal
 versions installed. Andres's disclamer is that it might make some
 gentoo-specific assumptions.
 
 Duncan
 
 On 24 August 2005 14:42, Duncan Coutts wrote:
 
 With our current 6.4.1 snapshot 20050819, we have problems building
 when we've got more than over version of cabal registered.
 
 That is we build it using ghc 6.4 and we have cabal-1.0 and
 cabal-1.1.2 installed. Then it complains that multiple packages
 match -package cabal. 
 
 It also has problems when no version of cabal is registered.
 
 There is no problem building with ghc 6.2.2 with no cabal installed.
 
 I think it would be much more reliable if ghc did not rely on the
 version of cabal installed and registered with ghc 6.4. Since it has
 to work without cabal anyway (for the 6.2.2 case), wouldn't it be
 possible to make it ignore any installed version of cabal even when
 building with ghc 6.4? 
 
 At the moment, it looks like we're going to have problems on gentoo
 upgrading users from ghc 6.4 to 6.4.1. Our current idea is to
 unregister the Cabal-1.0 package that ghc 6.4 comes with and use a
 later version (Cabal-1.1.2 at the moment) however it's not clear
 that ghc will cope with using the later version. We need to install
 the later version anyway for other reasons (version 1.0 has bugs and
 lacks some features we need for reasonable packaging) and ghc 6.4
 does not cope very well with having multiple versions of a package
 installed (this is improved in 6.4.1), hence the rationale for
 unregistering the 1.0 version entirely.
 
 ___
 Glasgow-haskell-bugs mailing list
 Glasgow-haskell-bugs@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: mysterious directory include error

2005-09-13 Thread Simon Marlow
On 13 September 2005 00:25, Frederik Eaton wrote:

 Works for me with a 6.4.1 snapshot.
 
 I've upgraded to 6.4.1.20050903 and it still doesn't work. Did you
 remember to create the empty directory 'foo'?
 
 Of course, I think there are two things wrong: (1) the fact that it
 doesn't work, (2) the fact that the error message is uninformative.
 
 Oh, I'm sorry, it's possible that I was using the wrong version. I
 think /usr/bin/runghc is version 6.4. However, it strangely reports
 being version 6.4.1:
 
 $ /usr/bin/runghc --version
 The Glorious Glasgow Haskell Compilation System, version
 6.4.1.20050903 $ /usr/bin/ghc --version
 The Glorious Glasgow Haskell Compilation System, version 6.4
 $ ghc --version
 The Glorious Glasgow Haskell Compilation System, version
 6.4.1.20050903 $ runghc --version
 runghc: syntax: runghc [-f GHCPATH] [GHC-ARGS] FILE ARG...[1]$
 
 When I use the newer version I am unable to reproduce the problem.
 
 (by the way, it would be nice if --version and --help were functional
 in the newer versions of runghc)

This happens because runghc uses whatever ghc is on your path, and it
passes any flags it doesn't understand to that ghc.

Cheers,
Simon
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: runghc takes modules from current working directory

2005-09-13 Thread Simon Marlow
On 12 September 2005 16:34, Frederik Eaton wrote:

 On Mon, Sep 12, 2005 at 12:41:32PM +0100, Simon Marlow wrote:
 On 20 August 2005 22:38, Frederik Eaton wrote:
 
 Hi,
 
 It seems like it would be nice to have runghc not take modules from
 the current working directory in many cases since it breaks
 abstraction. It looks like it may be only a real problem for
 debugging, when modules are supposed to be in a package somewhere,
 but aren't, and the current directory happens to have files of the
 same name, but in those cases it can be quite a pain to track down
 the error. The problem comes up especially often when one writes
 scripts in haskell to work with haskell packages or generate
 haskell code. Do people frequently use the find modules in the
 current directory feature, or could they be asked to do that with
 
 {-# OPTIONS_GHC -i. #-}
 
 ? (I don't think this works yet) Otherwise maybe a special option
 could be added to tell runghc not to look in the current directory?
 
 Frederik
 
 runghc -i foo.hs?
 
 I'm talking about #! scripts, for which the interpreter is hidden
 from the user. I tried putting #!/usr/bin/runghc -i at the top of a
 script and it failed with Failed to load interface for `Main'...

I'm assuming this is fixed with a newer version of runghc?

Cheers,
Simon
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1186741 ] stack overflow when loading a big

2005-09-13 Thread SourceForge.net
Bugs item #1186741, was opened at 2005-04-20 15:17
Message generated for change (Comment added) made by simonmar
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1186741group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Compiler
Group: 6.2.2
Status: Closed
Resolution: None
Priority: 5
Submitted By: Peter (peter26)
Assigned to: Nobody/Anonymous (nobody)
Summary: stack overflow when loading a big 

Initial Comment:
when loading a file with a very big list, ghci and ghc
give a stack overflow error (also when stack is
increase to 10M with the +RTS -Ksize option and stack
size is set to unlimited using ulimit -s unlimited in
linux). ghci also shows the error when loading the
file. it would be at least better to report that the
list is too big.


--

Comment By: Simon Marlow (simonmar)
Date: 2005-09-13 09:43

Message:
Logged In: YES 
user_id=48280

We have fixed some performance problems that show up when
you compile very long lists.  We don't believe GHC is using
non-linear stack, but it is reasonable for GHC to use linear
stack space when compiling a long list - after all it is
just syntactic sugar for a deeply nested expression.

You should find that 6.4.1 is better than 6.4 in terms of
performance, but it might not use less stack.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1186741group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1289569 ] hPutBuf doesn't respect LineBuffering

2005-09-13 Thread SourceForge.net
Bugs item #1289569, was opened at 2005-09-13 09:44
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1289569group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libraries/base
Group: 6.4
Status: Open
Resolution: None
Priority: 3
Submitted By: Simon Marlow (simonmar)
Assigned to: Simon Marlow (simonmar)
Summary: hPutBuf doesn't respect LineBuffering

Initial Comment:
On 15 April 2005 02:39, Ian Lynagh wrote:

 If I run this program:
 
 --
 import System.Cmd (system)
 import Foreign.C.String (castCharToCChar)
 import Foreign.Marshal.Array (newArray)
 import System.IO (hSetBinaryMode, hPutBuf, stdout,
hSetBuffering,
   BufferMode(..))
 
 main = do hSetBinaryMode stdout True
   hSetBuffering stdout LineBuffering
   p - newArray (map castCharToCChar foo\n)
   hPutBuf stdout p 4
   system sleep 5
   putStr bar\n
 --
 
 compiled by GHC then it waits 5 seconds and then
prints foo and bar
 together.
 
 With hugs, foo is printed and then 5 seconds later
bar is printed, as
 I would expect.

True, the implementation doesn't respect LineBuffering
(though it does
respect the other buffering modes, I believe).  That's
a bug.



--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1289569group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1285326 ] scavenge_one: strange object 47

2005-09-13 Thread SourceForge.net
Bugs item #1285326, was opened at 2005-09-08 20:18
Message generated for change (Comment added) made by tuananhbirm
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1285326group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: tuananhbirm (tuananhbirm)
Assigned to: Nobody/Anonymous (nobody)
Summary: scavenge_one: strange object 47

Initial Comment:

Hi, i am running GHC 6.4, in Redhat 9, running
sometimes with flag -threaded on.


Please look at the file Mult.hs

and function: startM1 (17-20)

run this function for different inputs (orignially,
multiply (1%7) with (0%2)) try to run with : (1%3) and
(0%1)
  (2%3) and (0%1)
  (1%2) and (0%1)
  (1%5) and (0%1)


Best regards
TuanAnh



--

Comment By: tuananhbirm (tuananhbirm)
Date: 2005-09-13 09:46

Message:
Logged In: YES 
user_id=1341750

 The program is supposed to compute an infinite list, so it
would never finish (however i never see the error after
100-150 digits). 

If you always get the result of [1,0,0,0,0. , then
try with inputs whose denominators are not power of 2 (like
(1%3 and 1%3)  
or (1%3 and 3%5)) ...

Best regards
TuanAnh

--

Comment By: Simon Marlow (simonmar)
Date: 2005-09-13 08:47

Message:
Logged In: YES 
user_id=48280

After fixing the bug, I ran the test program for about
30mins and it still hadn't finished.  Is there a way to run
it for, say, 5 seconds?

The fix will be in version 6.4.1.

--

Comment By: tuananhbirm (tuananhbirm)
Date: 2005-09-12 18:23

Message:
Logged In: YES 
user_id=1341750

 what do you mean by allow it to run for a shorter time ? 

btw, how do i use the fixed version of ghc ? (is there a
patch for this bug or something similar ? )

Thanks a lot
TuanAnh


--

Comment By: Simon Marlow (simonmar)
Date: 2005-09-12 15:56

Message:
Logged In: YES 
user_id=48280

Fixed now, thanks for a good report.

I'd like to use this as a test case - how can I provide
inputs that allow it to run for a shorter time?

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1285326group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1289573 ] mkProtoBCO: stack use won't fit in 16 bits 79141

2005-09-13 Thread SourceForge.net
Bugs item #1289573, was opened at 2005-09-13 09:48
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1289573group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Compiler
Group: 6.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Simon Marlow (simonmar)
Assigned to: Nobody/Anonymous (nobody)
Summary: mkProtoBCO: stack use won't fit in 16 bits 79141

Initial Comment:
ERROR MESSAGE:

Prelude :r
Compiling BookData ( ./BookData.hs, interpreted )
ghc-6.2.2: panic! (the `impossible' happened, GHC
version 6.2.2):
mkProtoBCO: stack use won't fit in 16 bits 79141

Test case and rest of message here:

http://www.haskell.org//pipermail/glasgow-haskell-bugs/2005-March/004871.html

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1289573group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-807249 ] Instance match failure on openTypeKind

2005-09-13 Thread SourceForge.net
Bugs item #807249, was opened at 2003-09-16 16:37
Message generated for change (Settings changed) made by simonmar
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=807249group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Compiler (Type checker)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Simon Peyton Jones (simonpj)
Assigned to: Simon Peyton Jones (simonpj)
Summary: Instance match failure on openTypeKind

Initial Comment:
Consider

instance Show (a-gt;b) where ...

foo x = show (\ _ -gt; True)

This fails with:
No instance for (Show (t -gt; Bool))
  arising from use of `show' at Foo.hs:5


Reason: the type of (\_ -gt; True) is  (t -gt; Bool) where
t has an quot;openTypeKindquot;.  It's possible that the function 
will be applied to say an Int#, and the openTypeKind 
records that this is OK.

BUT, the instance decl Show (a-gt;b) has 
a::liftedTypeKind, and that doesn't match an 
openTypeKind type variable.


This bug relates to GHC's unsatisfactory treatment of 
the variants of kind quot;typequot;, for which there are at least 2 
other SourceForge bugs registered (753780 and  
753777).  It's very obscure, so I'm not going to fix it 
today.

--

Comment By: Simon Marlow (simonmar)
Date: 2005-07-11 10:36

Message:
Logged In: YES 
user_id=48280

ghci015 now tests for this bug.

--

Comment By: Simon Peyton Jones (simonpj)
Date: 2005-05-23 12:57

Message:
Logged In: YES 
user_id=50165

I'm bumping up the priority of this bug, because it also 
happens if, in GHCi, you say

   Prelude :m +Text.Show.Functions
  Text.Show.Functions print (\x - x)

  (this elicits a no-such-instance error)

It's even more perplexing that this does not happen if you say
print id

becuase 'id' has kind-defaulted type variables in its type.  
Sigh.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=807249group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: memory allocation failed

2005-09-13 Thread David F. Place
Yes, it does seem that it has just run out of memory.  In that case,  
the bug is the error message that instructs me to make a bug report.


On Sep 13, 2005, at 5:02 AM, Simon Marlow wrote:


On 09 September 2005 15:40, David F. Place wrote:



My program terminated with the following message:

pal: internal error: memory allocation failed (requested 2097152
 bytes) Please report this as a bug to
glasgow-haskell-bugs@haskell.org,



Forgive me for asking the obvious, but is it possible that you ran out
of memory?

If not, then yes we'd like to see your test case please.

Cheers,
Simon




David F. Place
mailto:[EMAIL PROTECTED]

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: memory allocation failed

2005-09-13 Thread Simon Marlow
On 13 September 2005 11:47, David F. Place wrote:

The non-Darwin version of that error message does indicate out of
memory.

Wolfgang: can we detect out of memory on Darwin too?

Cheers,
Simon

 Yes, it does seem that it has just run out of memory.  In that case,
 the bug is the error message that instructs me to make a bug report.
 
 On Sep 13, 2005, at 5:02 AM, Simon Marlow wrote:
 
 On 09 September 2005 15:40, David F. Place wrote:
 
 
 My program terminated with the following message:
 
 pal: internal error: memory allocation failed (requested 2097152
  bytes) Please report this as a bug to
 glasgow-haskell-bugs@haskell.org,
 
 
 Forgive me for asking the obvious, but is it possible that you ran
 out of memory? 
 
 If not, then yes we'd like to see your test case please.
 
 Cheers,
 Simon
 
 
 
 David F. Place
 mailto:[EMAIL PROTECTED]
 
 ___
 Glasgow-haskell-bugs mailing list
 Glasgow-haskell-bugs@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: problems building ghc 6.4.1_pre using 6.4 with multiplecabalversions installed

2005-09-13 Thread Andres Loeh
 Just glancing over the patch, I can't immediately see how it works.  GHC
 6.4 gives priority to package modules over modules on the local search
 path, so Distribution.* will be taken from the installed Cabal package.
 However, when linking GHC you are ommitting -package Cabal, so I'd
 expect a link error.
 
 Hmm, I guess I should try this and figure out what's happening.

The idea is that no installed Cabal version will be used. I think the
ghc distribution should just always build its own Cabal during stage1.
That's what the patch tries to achieve, and afaics, it works. However,
Duncan didn't give you the full story with the patch. We also do the
following:

echo GHC+=-ignore-package Cabal  mk/build.mk
echo HC+=-ignore-package Cabal  mk/build.mk

This was the only way I could find to make sure that a preinstalled
Cabal is ignored whenever the preinstalled ghc is called, but not once
the in-place ghc is available.

Cheers,
  Andres
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: problems building ghc 6.4.1_pre using 6.4 withmultiplecabalversions installed

2005-09-13 Thread Simon Marlow
On 13 September 2005 12:22, Andres Loeh wrote:

 Just glancing over the patch, I can't immediately see how it works. 
 GHC 
 6.4 gives priority to package modules over modules on the local
 search path, so Distribution.* will be taken from the installed
 Cabal package. However, when linking GHC you are ommitting -package
 Cabal, so I'd expect a link error. 
 
 Hmm, I guess I should try this and figure out what's happening.
 
 The idea is that no installed Cabal version will be used. I think the
 ghc distribution should just always build its own Cabal during stage1.

I agree - I just couldn't see how your patch achieved that.

 That's what the patch tries to achieve, and afaics, it works. However,
 Duncan didn't give you the full story with the patch. We also do the
 following:
 
 echo GHC+=-ignore-package Cabal  mk/build.mk
 echo HC+=-ignore-package Cabal  mk/build.mk

Aha, that's the missing bit.  I'll try to construct a robust version of
this.

Cheers,
Simon
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: GADT: weird error message

2005-09-13 Thread Simon Peyton-Jones
Yes, GHC has a special rule to handle case-of-expression.  (We call it
smart-app in the paper.)  But GHC's front end retains all syntax,
including tuple syntax, and I failed to do the special rule for tuple
syntax.  Sorry!

Perhaps you can file it as a Sourceforge bug.  I'm going to do a raft of
changes to GADTs in the autumn, and by filing it you'll ensure I don't
forget.

BTW, what are you using GADTs for?  Any other unexpected surprises?

Thanks

Simon


| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-bugs-
| [EMAIL PROTECTED] On Behalf Of Arthur Baars
| Sent: 06 September 2005 16:48
| To: glasgow-haskell-bugs@haskell.org
| Subject: GADT: weird error message
| 
| In the code below the function trans is accepted by GHC 6.4, but
| trans1 is not. I would expect that (x,y) is just syntactic sugar
| for (,) x y, but apparently it isn't. I guess this is a bug; can
| anyone explain what is going on?
| 
| Cheers,
| 
| Arthur
| 
| The Code:
| data Equal a b where
|   Eq :: Equal a a
| 
| trans :: forall a b c. Equal a b - Equal b c - Equal a c
| trans = \x - \y - case (,) x  y  of
|  (Eq,Eq ) - Eq
| 
| trans1 :: forall a b c. Equal a b - Equal b c - Equal a c
| trans1 = \x - \y - case (x, y)  of
|  (Eq,Eq ) - Eq
| 
| The error message:
| Test2.hs:9:0:
|  Quantified type variable `c' is unified with another quantified
| type variable a
|  When trying to generalise the type inferred for `trans1'
|Signature type: forall a b c. Equal a b - Equal b c -
Equal
| a c
|Type to generalise: Equal a b - Equal b a - Equal a a
|  In the type signature for `trans1'
|  When generalising the type(s) for `trans1'
| 
| ___
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: runghc takes modules from current working directory

2005-09-13 Thread Frederik Eaton
On Tue, Sep 13, 2005 at 10:15:39AM +0100, Simon Marlow wrote:
 On 12 September 2005 16:34, Frederik Eaton wrote:
 
  On Mon, Sep 12, 2005 at 12:41:32PM +0100, Simon Marlow wrote:
  On 20 August 2005 22:38, Frederik Eaton wrote:
  
  Hi,
  
  It seems like it would be nice to have runghc not take modules from
  the current working directory in many cases since it breaks
  abstraction. It looks like it may be only a real problem for
  debugging, when modules are supposed to be in a package somewhere,
  but aren't, and the current directory happens to have files of the
  same name, but in those cases it can be quite a pain to track down
  the error. The problem comes up especially often when one writes
  scripts in haskell to work with haskell packages or generate
  haskell code. Do people frequently use the find modules in the
  current directory feature, or could they be asked to do that with
  
  {-# OPTIONS_GHC -i. #-}
  
  ? (I don't think this works yet) Otherwise maybe a special option
  could be added to tell runghc not to look in the current directory?
  
  Frederik
  
  runghc -i foo.hs?
  
  I'm talking about #! scripts, for which the interpreter is hidden
  from the user. I tried putting #!/usr/bin/runghc -i at the top of a
  script and it failed with Failed to load interface for `Main'...
 
 I'm assuming this is fixed with a newer version of runghc?

Yep, sorry.

Frederik

-- 
http://ofb.net/~frederik/
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: FFI: calling Haskell from C++?

2005-09-13 Thread Wolfgang Thaller
we have tried long and hard to call Haskell functions from C++ usingthe FFI mechanism but without success. Don't forget to say which platform you're on - the solution might be slightly platform-dependent.  $ ghc -fffi Foo.o Foo_stub.o main.cpp   main.o(.text+0x22): In function `main':  main.cpp: undefined reference to `__stginit_Foo()'#ifdef __GLASGOW_HASKELL__extern void __stginit_Foo ( void );#endifThis should be...extern "C" void __stginit_Foo ( void );  main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'  collect2: ld returned 1 exit statusOn Mac OS X, all you need to do is add -lstdc++ to your ghc command line; it may or may not be that easy on other platforms.Cheers,Wolfgang___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: FFI: calling Haskell from C++?

2005-09-13 Thread Rich Neswold
On 9/13/05, Felix Breuer [EMAIL PROTECTED] wrote:
 $ ghc -fffi Foo.o Foo_stub.o main.cppmain.o(.text+0x22): In function `main':main.cpp: undefined reference to `__stginit_Foo()'main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'collect2: ld returned 1 exit status

In main.cpp, you need to define __stginit_Foo(void) like this:

 extern C void __stginit_Foo(void);
Specifying the C linkage with prevent the compiler from looking for a name-mangled version of the function.

To fix the second problem, you need to shut off exception handling
(specifying the -fno-exceptions option ought to do this. I don't know
how to pass compiler option via ghc, though.
-- RichAIM : rnezzyICQ : 174908475
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: FFI: calling Haskell from C++?

2005-09-13 Thread Felix Breuer
Hello everyone,

the examples are working now! John, Wolfgang and Rich, thank you for your help!

On Wed, 14 Sep 2005 02:07:52 +1000
skaller [EMAIL PROTECTED] wrote:

 On Tue, 2005-09-13 at 15:20 +, Felix Breuer wrote:
main.o(.text+0x22): In function `main':
main.cpp: undefined reference to `__stginit_Foo()'

This was solved by

  extern C void __stginit_Foo(void);


main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

and this by adding -lstdc++ to the ghc command line options. My platform
is Linux 2.6.11 running GCC 3-4-4..

I will now try to apply this to my application. I will see if I run
into trouble when I actually use C++ code (and not just rename a C
source file). 


 There is one more problem: you MUST NOT run gcc on files
 ending in *.cpp. You are REQUIRED to run g++. So you will have
 to somehow tell ghc to use g++ and NOT gcc. in particular
 C++ programs require different startup code to C, to initialise
 exception handling, etc etc. So the whole program MUST be 
 linked by g++, not gcc, and the main() must be compiled with
 g++ not gcc. 


Is it possible to have ghc compile _and_ _link_ all the Haskell code,
and then using g++ to compile the C++ code and link everything together?

I tried using ghc to only compile the .hs files and have g++ do all the
linking but I only got a bunch of undefined references due to the GHC
libs not being linked into the executable. I always relied on ghc --make 
to figure out the dependencies here, and now I don't know which files
to link against...


Thanks again,
Felix
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell] OOHaskell -- major release of report and library

2005-09-13 Thread Ralf Lammel
An extended technical report has been released at:
TR  software: http://homepages.cwi.nl/~ralf/OOHaskell/ 
TR: http://arxiv.org/abs/cs.PL/0509027 

Haskell's overlooked object system
10 September 2005, 79 pages

by O. Kiselyov (FNMOC, Monterey, CA, USA)
and R. Laemmel (Microsoft Corp., WA, USA)

Some recently added topics:

- Many Haskell 98 encodings
- Safe value recursion
- Safe downcasts
- Safe co-variant method arguments
- Nominal subtyping
- Iso-recursive object types
- With and depth subtyping

The report describes and classifies all principled, to our best
knowledge, object encodings in Haskell98, with and without common
extensions.

On the one hand, this report covers many advanced topics, as to make it
interesting for programming language researchers. On the other hand, the
report is detailed and lightweight enough to be useful as an OO-FP
tutorial.

Regards,
Oleg and Ralf

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] StringMaps available

2005-09-13 Thread Adrian Hey
Hello,

I've put the first release of Data.StringMap here..
 http://homepages.nildram.co.uk/~ahey/HLibs/Data.StringMap/

The implementation is a bit different than what was discussed
earlier as I decided the first version would burn heap unecessarily.
It's still based on Tries though.

I'm afraid I won't be able to do much Haskelling for a few months
so not much will be added in the near future. But if anybody would
like to use this but finds the absence of some function or other
a show stopping issue then let me know and I'll add it.

Regards
--
Adrian Hey

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


RE: [Haskell] reading call graphs

2005-09-13 Thread Simon Marlow
On 24 August 2005 11:10, Malcolm Wallace wrote:

 Scherrer, Chad [EMAIL PROTECTED] writes:
 
 individualinherited
 COST CENTRE  MODULE   no.entries  %time %alloc   %time %alloc
 
 
 MAIN MAIN  1   0   0.00.0   100.0  100.0
  mainMain228   92329   0.20.999.8   99.8
   step   Main259 679  38.4   26.656.6   39.2
 
 I'm trying to understand the entries column. I thought this was the
 number of times a given function is called. But main is
 nonrecursive, and only calls step (also nonrecursive) once. Where
 are the 92329 and 679 coming from?
 
 Perhaps these functions are split into smaller chunks by the
 compiler/optimiser?  Then the profiler would aggregate the data for
 the individual chunks back up into the original cost centre.

That's a plausible hypothesis.  Each time an expression of the form ({-#
SCC foo #-} e) is evaluated, the entries count for foo is
incremented.  The effect of -auto-all is to wrap each top-level function
in an {-# SCC #-} expression, so you would normally get one entry per
call of the function.  However, the optimiser can change the structure
of the code.  Optimisations are supposed to retain the cost attribution
model, but they don't necessarily retain the same entry counts.

Basically I find the entries figure is a useful sanity check (i.e. is
this function called at all?), but not much more than that.

Cheers,
Simon
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell-cafe] Template Haskell and Types

2005-09-13 Thread Gracjan Polak

Tomasz Zielonka wrote:

On Mon, Sep 12, 2005 at 12:08:14PM +0200, Gracjan Polak wrote:

Probably very simple question about template haskell: How do I make a 
type for an argument to splice? Example:


data MyData = MyData1 | MyData2

mysplice mytype =
  [| litE $ stringL $ show mytype |]

main = do
  putStrLn $(mysplice MyData)



Cale explained how you can quote types in general. In the special case
when you simply want the Name of a type-constructor, you can use the ''
quoting syntax:

putStrLn $(mysplice ''MyData)



Thanks for responses. Is there any up-to-date documentation avaliable?


Best regards
Tomasz


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Language Workbenches - the Haskell solution?

2005-09-13 Thread Yitzchak Gale
Correction - I wrote:

 If you want a GUI for configuration, you could,
 for example, write a fairly simple transformation
 of the master XML into a .NET dialog, or glade
 file for GTK, or whatever. We never did that,
 though.

Actually, Yael Weinbach wrote a beautiful GUI
for this configuration scheme. I apologize
to Yael for the omission.

Regards,
Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Template Haskell and Types

2005-09-13 Thread Simon Peyton-Jones

|  putStrLn $(mysplice ''MyData)
| 
| 
| Thanks for responses. Is there any up-to-date documentation avaliable?

Template Haskell is, alas, poorly documented.  I would really welcome
someone to volunteer to help write better documentation.  Meanwhile, as
the user manual says, the stuff about quoting names is described in a
design note http://research.microsoft.com/~simonpj/tmp/notes2.ps

Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Template Haskell and Types

2005-09-13 Thread Benjamin Franksen
On Tuesday 13 September 2005 09:16, Gracjan Polak wrote:
 Tomasz Zielonka wrote:
  On Mon, Sep 12, 2005 at 12:08:14PM +0200, Gracjan Polak wrote:
 Probably very simple question about template haskell: How do I make
  a type for an argument to splice? Example:
 
 data MyData = MyData1 | MyData2
 
 mysplice mytype =
[| litE $ stringL $ show mytype |]
 
 main = do
putStrLn $(mysplice MyData)
 
  Cale explained how you can quote types in general. In the special
  case when you simply want the Name of a type-constructor, you can
  use the '' quoting syntax:
 
  putStrLn $(mysplice ''MyData)

 Thanks for responses. Is there any up-to-date documentation
 avaliable?

The only I know of is the TH 'update' paper, where e.g. the single ('a) 
and double (''a) quote syntax is explained: 
http://research.microsoft.com/~simonpj/tmp/notes2.ps

Ben
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Language Workbenches - First attempt

2005-09-13 Thread Yoel Jacobsen

source = #123456789012345678901234567890123456789012345678901234567890\n\
\SVCLFOWLER 10101MS0120050313.\n\
\SVCLHOHPE  10201DX0320050315\n\
\SVCLTWO   x10301MRP220050329..\n\ 
   \USGE10301TWO 
x50214..7050329...


type ConfigLine = (String, [(String, (Int, Int))])
type Configuration = [ConfigLine]
type KeyVal = (String, String)
type Header = String
type Entry = (Header, [KeyVal])

config :: Configuration
config = [(SVCL, [(CustomerName, (4, 18)),
(CustomerID, (19, 23)),
(CallTypeCode, (24, 27)),
(DateOfCallString, (28, 35))]),

  (USGE, [(CustomerID, (4, 8)),
(CustomerName, (9, 22)),
(Cycle, (30, 30)),
(ReadDAte, (31, 36))])]

getRange :: Int - Int - [a] - [a]
getRange a b l = take (b-a+1) $ drop a l

lineToFields :: String - [(Int,Int)] - [String]
lineToFields line points = map (fieldFromTo line) points
where fieldFromTo line (x,y) = getRange x y line

lineType :: String - String
lineType = getRange 0 3

applyConfig :: String - ConfigLine - [KeyVal]
applyConfig line (ckey, cval) =
if lineType line == ckey
then zip names $ lineToFields line points
else []
where part = unzip cval
  names = fst part
  points = snd part

parseLine :: Configuration - String - Entry
parseLine cnf line = (header, parsed)
where rawData :: [[KeyVal]]
  rawData = map (applyConfig line) cnf
  parsed :: [KeyVal]
  parsed = head $ dropWhile null rawData
  header = lineType line

parse :: Configuration - [String] - [Entry]
parse cnf lines = map (parseLine cnf) lines

run = parse config $ filter noComment $ lines source
where noComment = \x - (head x) /= '#'


== Output
*Main run
[(SVCL,[(CustomerName,FOWLER 
),(CustomerID,10101),(CallTypeCode,MS01),(DateOfCallString,20050313)]),(SVCL,[(CustomerName,HOHPE 

),(CustomerID,10201),(CallTypeCode,DX03),(DateOfCallString,20050315)]),(SVCL,[(CustomerName,TWO 

x),(CustomerID,10301),(CallTypeCode,MRP2),(DateOfCallString,20050329)]),(USGE,[(CustomerID,10301),(CustomerName,TWO 
 x),(Cycle,7),(ReadDAte,050329)])]

*Main



Yoel Jacobsen wrote:
It seems that Martin Fowler's article Language Workbenches: The 
killer-App for Domain Specific Languages? - 
http://www.martinfowler.com/articles/languageWorkbench.html - has 
generated some nice dynamic solution where a configuration file is 
written in the same language as the program. Notable examples are lisp - 
http://lispm.dyndns.org/news?ID=NEWS-2005-07-08-1 and python - 
http://billionairebusinessman.blogspot.com/2005/09/drop-that-schema-and-put-your-hands-in.html 



I'm trying to create an _elegant_ solution in Haskell. But I'm stuck. 
Since the native record-like access in Haskell syntax is using labelled 
fields in datatype decleration but the later are strictly compile-time. 
Therefore, if I compile my program and add a field in the configuration 
file (written in Haskell, using, for instance hs-plugins), I'll need to 
recompile the data declaration as well.


Further, what is the type of the parser? Consider the following 
implementation:


source = #123456789012345678901234567890123456789012345678901234567890\n\
 \SVCLFOWLER 10101MS0120050313.\n\
 \SVCLHOHPE  10201DX0320050315\n\
 \SVCLTWO   x10301MRP220050329..\n\ 
\USGE10301TWO x50214..7050329...


data Configuration = Config String [(String, Int, Int)]

config = [
  Config SVCL [(CustomerName, 4, 18),
 (CustomerID, 19, 23),
 (CallTypeCode, 24, 27),
 (DateOfCallString, 28, 35)],

  Config USGE [(CustomerID, 4, 8),
 (CustomerName, 9, 22),
 (Cycle, 30, 30),
 (ReadDAte, 31, 36)]]

-- parse takes the configuration, a line from the source string and 
generate a record


parse :: Configuration - String - Record


What is the type of Record?

Anyway, any elegant solution or a hint towards one are most welcome.

Thanks,
  Yoel


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] RE: [Haskell] ANNOUNCE: ghc-src version 0.2.0

2005-09-13 Thread Simon Marlow
On 30 August 2005 12:05, Arthur Baars wrote:

 Daan is right, I wrote a parser for GHC using Doaitse Swierstra's
 parsing combinator library
 (http://www.cs.uu.nl/groups/ST/Software/UU_Parsing/index.html).
 I needed a drop-in replacement for GHC's Happy parser, to make a
 prototype for syntax macros. Syntax Macros allow a programmer to
 extend a language with new syntax. Combinator based parsers parsers
 can be dynamically extended, making them suitable for implementing
 syntax macros.  Unfortunately, I never had time to really finish the
 syntax macro implementation.
 
 But I did finish the combinator based parser for GHC. I tested it by
 having GHC( with combinator parser) compile itself and all the
 libraries. This took about 10% longer than with the original GHC, so
 in practice its speed is acceptable.

With all due respect, a 10% increase in compile time isn't acceptable at
all!

And when you consider that parsing is less than 10% of compile time
overall (probably much less), a 10% increase represents at least a
factor of 2 in the parser.

I'm not criticising the work at all - far from it, just the notion that
we would consider adding 10% to GHC's compile times acceptable.  I've
recently  been struggling to shave a few percent off GHC's compile
times, BTW :-)

Cheers,
Simon

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] RE: [Haskell] mailing list headaches

2005-09-13 Thread Simon Marlow
On 08 September 2005 17:53, Glynn Clements wrote:

 Frederik Eaton wrote:
 
 However, threading by References, which RFC 2822 says
 SHOULD be possible, and which works on my other folders, doesn't work
 well on Haskell mailing lists. Presumably the issue is that there are
 a large number of Windows users with strange mail clients which don't
 insert References headers.
 
 It isn't so much that there are a large number of such users, but that
 two of the core developers are among them (and are both employed by
 Microsoft, so RFC-conformance probably isn't an option).

Yes, this is partially our fault.  When using Outlook through Exchange,
the In-Reply-To header isn't generated at all.  Outlook via SMTP works
fine, though.  I reported the bug several years ago, let's see if Office
12 fixes it :)

Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Dhaemon
Hello,
I'm quite interested in haskell, but there is something I don't
understand(intuitively). I've been crawling the web for an answer, but
nothing talks to me...
So I was hoping I could find some help here:
How is evaluating an _expression_ different from performing action?
I'm puzzled... Doesn't it amount to the same thing? Maybe I have a
wrong definition of evaluating(determine the value of an _expression_)?
Examples would be appreciated.
Also, just for kicks, may I had this: I read the code of some
haskell-made programs and was astonished. Yes! It was clean and
all, but there were dos everywhere... Why use a function language if
you use it as an imperative one?(i.e. most of the apps in
http://haskell.org/practice.html)

Thanks in advance,
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Thomas Davie


On 13 Sep 2005, at 14:45, Dhaemon wrote:



Hello,
I'm quite interested in haskell, but there is something I don't  
understand(intuitively). I've been crawling the web for an answer,  
but nothing talks to me...

So I was hoping I could find some help here:
How is evaluating an expression different from performing action?
I'm puzzled... Doesn't it amount to the same thing? Maybe I have a  
wrong definition of evaluating(determine the value of an  
expression)?

Examples would be appreciated.
Also, just for kicks, may I had this: I read the code of some  
haskell-made  programs and was astonished. Yes! It was clean and  
all, but there were dos everywhere... Why use a function language  
if you use it as an imperative one?(i.e. most of the apps in http:// 
haskell.org/practice.html)




The difference is all about referential transparency -- in short, a  
function given the same inputs will always give the same result.   
This is not the same as in imperative languages, where functions/ 
methods/actions can have 'side-effects' that change the behavior of  
the rest of the program.


Take this example:

C program:
#define square(x) ((x) * (x))
#define inc(x) ((x)++)

int myFunc (int *x)
{
return square(inc(*x));
}

the C preprocessor will re-write the return line to:
return x)++)) * (((x)++)));

this will be performed in sequence, so, x will be incremented  
(changing the value of x), and that result will be multiplied by x  
incremented again.


so if we run myFunc(y), where y is 5, what we get is 5 incremented  
to 6, and them multiplied by 6 incremented to 7.  So the result of  
the function is 42 (when you might reasonably expect 36), and y is  
incremented by 2, when you might reasonably expect it to be  
incremented by 1.


Haskell program:

square x = x * x
inc = (+1)
myFunc = square . inc

and we now call myFunc 5, we get this evaluation:

myFunc 5 is reduced to (square . inc) 5
(square . inc) 5 is reduced to square (inc 5)
square (inc 5) is reduced to square ((+1) 5)
square ((+1) 5) is reduced to square 6
square 6 is reduced to 6 * 6
6 * 6 is reduced to 36

If you want to study these reductions on a few more examples, you  
might want to download the Hat tracer, and use hat-anim to display  
reductions step by step.


Bob

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Binary parser combinators and pretty printing

2005-09-13 Thread Einar Karttunen
Hello

I am trying to figure out the best interface to binary parser
and pretty printing combinators for network protocols. 

I am trying to find the most natural syntax to express
these parsers in Haskell and would like opinions and
new ideas.

As an example I will use a protocol with the following packet structure:
0  message-id
4  sender-id
8  receiver-id
12 number of parameters
16 parameters. Each parameter is prefixed by 32bit length followed by 
   the data.

We will use the following Haskell datatype:

data Packet = Packet Word32 Word32 Word32 [FastString]

1) Simple monadic interface

getPacket = do mid - getWord32BE
   sid - getWord32BE
   rid - getWord32BE
   nmsg- getWord32BE
   vars- replicateM (fromIntegral nmsg) (getWord32BE = getBytes)
   return $ Packet mid sid rid nmsg vars

putPacket (Packet mid sid rid vars) = do
  mapM_ putWord32BE [mid, sid, rid, length vars]
  mapM_ (\fs - putWord32BE (length fs)  putBytes fs) vars


This works but writing the code gets tedious and dull. 

2) Using better combinators

packet = w32be  w32be  w32be  lengthPrefixList w32be (lengthPrefixList 
w32be bytes)
getPacket = let (mid,sid,rid,vars)  = getter packet in Packet mid sid rid vars
putPacket (Packet mid sid rid vars) = setter packet mid sid rid vars

Maybe even the tuple could be eliminated by using a little of TH.
Has anyone used combinators like this before and how did it work?

3) Using TH entirely

$(getAndPut 'Packet w32 w32 w32 lengthPrefixList (w32 bytes))

Is this better than the combinators in 2)? Also what sort of 
syntax would be best for expressing nontrivial dependencies - 
e.g. a checksum calculated from other fields.

4) Using a syntax extension

Erlang does this with the bit syntax 
(http://erlang.se/doc/doc-5.4.8/doc/programming_examples/bit_syntax.html)
and it is very nifty for some purposes. 

getPacket = do  mid:32, sid:32, rid:32, len:32 rest:len/binary 
   ...

The list of lists gets nontrivial here too...


- Einar Karttunen
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Thomas Spriggs

Small point,


From: Thomas Davie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
CC: Haskell-Cafe@haskell.org
Subject: Re: [Haskell-cafe] Functional vs Imperative
Date: Tue, 13 Sep 2005 14:55:14 +0100


On 13 Sep 2005, at 14:45, Dhaemon wrote:



Hello,
I'm quite interested in haskell, but there is something I don't  
understand(intuitively). I've been crawling the web for an answer,  but 
nothing talks to me...

So I was hoping I could find some help here:
How is evaluating an expression different from performing action?
I'm puzzled... Doesn't it amount to the same thing? Maybe I have a  wrong 
definition of evaluating(determine the value of an  expression)?

Examples would be appreciated.
Also, just for kicks, may I had this: I read the code of some  
haskell-made  programs and was astonished. Yes! It was clean and  all, but 
there were dos everywhere... Why use a function language  if you use it 
as an imperative one?(i.e. most of the apps in http:// 
haskell.org/practice.html)




The difference is all about referential transparency -- in short, a  
function given the same inputs will always give the same result.   This is 
not the same as in imperative languages, where functions/ methods/actions 
can have 'side-effects' that change the behavior of  the rest of the 
program.


Take this example:

C program:
#define square(x) ((x) * (x))
#define inc(x) ((x)++)

int myFunc (int *x)
{
return square(inc(*x));
}

the C preprocessor will re-write the return line to:
return x)++)) * (((x)++)));

Shouldn't that be:
return *x)++)) * (((*x)++)));


this will be performed in sequence, so, x will be incremented  (changing 
the value of x), and that result will be multiplied by x  incremented 
again.


so if we run myFunc(y), where y is 5, what we get is 5 incremented  to 6, 
and them multiplied by 6 incremented to 7.  So the result of  the function 
is 42 (when you might reasonably expect 36), and y is  incremented by 2, 
when you might reasonably expect it to be  incremented by 1.


Haskell program:

square x = x * x
inc = (+1)
myFunc = square . inc

and we now call myFunc 5, we get this evaluation:

myFunc 5 is reduced to (square . inc) 5
(square . inc) 5 is reduced to square (inc 5)
square (inc 5) is reduced to square ((+1) 5)
square ((+1) 5) is reduced to square 6
square 6 is reduced to 6 * 6
6 * 6 is reduced to 36

If you want to study these reductions on a few more examples, you  might 
want to download the Hat tracer, and use hat-anim to display  reductions 
step by step.


Bob

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_
The new MSN Search Toolbar now includes Desktop search! 
http://toolbar.msn.co.uk/


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread David Roundy
On Tue, Sep 13, 2005 at 01:45:52PM +, Dhaemon wrote:
 Also, just for kicks, may I had this: I read the code of some haskell-made 
 programs and was astonished. Yes! It was clean and all, but there were dos 
 everywhere... Why use a function language if you use it as an imperative 
 one?(i.e. most of the apps in http://haskell.org/practice.html)

Monadic code isn't synonymous with imperative code, and do only indicates
that you're looking at monadic code.  The Maybe monad is an example of a
very useful, very non-imperative monad that can be used to cleanly write
functional code.

On the other hand, IO is always monadic, so perhaps you're looking at IO
code.  But I'd assert that even monadic IO code isn't quite the same as
true imperative code.  I'd probably say that the difference has to do
with whether you create modifiable variables.  When you start doing that,
whether you're in the ST monad or the IO monad, I think you're writing
imperative-style code.  But I think that that sort of usage is actually
pretty uncommon.
-- 
David Roundy
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Binary parser combinators and pretty printing

2005-09-13 Thread Malcolm Wallace
Einar Karttunen ekarttun@cs.helsinki.fi writes:

 I am trying to figure out the best interface to binary parser
 and pretty printing combinators for network protocols. 
 
 2) Using better combinators
 
 packet = w32be  w32be  w32be  lengthPrefixList w32be (lengthPrefixList 
 w32be bytes)
 Has anyone used combinators like this before and how did it work?

Yes, the nhc98 Binary library has a  combinator, in very much
the style you outline.  It is only used in pure code, but it permits
some very concise descriptions of the binary layout.  The library is
described here:

ftp://ftp.cs.york.ac.uk/pub/malcolm/ismm98.html

but unfortunately that paper has only the tiniest examples of the
usage of .  However, in my experience the style worked well and
was pleasant to use.

Regards,
Malcolm
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Weak hashtable memoization code?

2005-09-13 Thread Simon Marlow
On 28 August 2005 16:39, Bulat Ziganshin wrote:

 Hello David,
 
 Sunday, August 28, 2005, 4:19:07 PM, you wrote:
 
 Hi all,
 
 Does anyone have a nice bit of example code to implement memoization
 using weak pointers and hash tables? It would be nice to have a
 pre-packaged module that I could just use, which has already been
 tested.  The contents of Data.WeakPtr seem a bit lower-level than
 I'd rather work with. 
 
 http://www.haskell.org/~simonmar/papers/weak.pdf

There's the memo table implementation in the util package:
hslibs/util/Memo.lhs.  Note that this is scheduled for demolition in GHC
6.6.

Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Thomas Davie


On 13 Sep 2005, at 16:22, David Roundy wrote:


On Tue, Sep 13, 2005 at 01:45:52PM +, Dhaemon wrote:

Also, just for kicks, may I had this: I read the code of some  
haskell-made
programs and was astonished. Yes! It was clean and all, but there  
were dos
everywhere... Why use a function language if you use it as an  
imperative

one?(i.e. most of the apps in http://haskell.org/practice.html)



Monadic code isn't synonymous with imperative code, and do only  
indicates
that you're looking at monadic code.  The Maybe monad is an example  
of a
very useful, very non-imperative monad that can be used to cleanly  
write

functional code.

On the other hand, IO is always monadic, so perhaps you're looking  
at IO
code.  But I'd assert that even monadic IO code isn't quite the  
same as
true imperative code.  I'd probably say that the difference has  
to do
with whether you create modifiable variables.  When you start  
doing that,

whether you're in the ST monad or the IO monad, I think you're writing
imperative-style code.  But I think that that sort of usage is  
actually

pretty uncommon.


I would tend to argue that even in those monads you aren't really  
writing imperative style code -- you still can't have side effects.   
The point of the monad is that it preserves referential transparency  
while doing something ordered.


Bob
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Haskell poker server

2005-09-13 Thread Simon Marlow
On 28 August 2005 20:00, Joel Reymont wrote:

 I get a message from Erlang once data arrives over TCP and the
 message is a {tcp, Socket, Bin} tuple where Bin is binary data. I can
 easily extract what I need using Erlang binary pattern matching:
 
 read(24, GID:32, Seq:16) -
  {24, GID, Seq}.

I didn't see anyone mention this (apologies if I missed it), but the
House project does parsing of network packets and has some useful
combinators for parsing binary data:

http://www.cse.ogi.edu/~hallgren/House/

Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Wolfgang Jeltsch
Am Dienstag, 13. September 2005 15:45 schrieb Dhaemon:
 [...]

 Also, just for kicks, may I had this: I read the code of some haskell-made
 programs and was astonished. Yes! It was clean and all, but there were
 dos everywhere... Why use a function language if you use it as an
 imperative one?(i.e. most of the apps in http://haskell.org/practice.html)

Note that do expressions are not expressions whose evaluation has 
side-effects.  The evaluation of a do expression doesn't yield the result of 
the action it describes, causing side-effects, but it yields the action 
itself.  Evaluation of this action is done seperately.

 Thanks in advance,

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Template Haskell and Types

2005-09-13 Thread Gracjan Polak

Simon Peyton-Jones wrote:

|  putStrLn $(mysplice ''MyData)
| 
| 
| Thanks for responses. Is there any up-to-date documentation avaliable?


Template Haskell is, alas, poorly documented.  I would really welcome
someone to volunteer to help write better documentation.  Meanwhile, as
the user manual says, the stuff about quoting names is described in a
design note http://research.microsoft.com/~simonpj/tmp/notes2.ps


Thanks. With haddoc documentation it is quite easy to translate old 
names to new names and guess the meanning of others.


Next quiestion is: how do I debug my macros? When I make some error in 
my program, I get coredump (or the windows equivalent)?



--
Gracjan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Sebastian Sylvan
On 9/13/05, Dhaemon [EMAIL PROTECTED] wrote:
 Hello,
  I'm quite interested in haskell, but there is something I don't
 understand(intuitively). I've been crawling the web for an answer, but
 nothing talks to me...
  So I was hoping I could find some help here:
  How is evaluating an expression different from performing action?
  I'm puzzled... Doesn't it amount to the same thing? Maybe I have a wrong
 definition of evaluating(determine the value of an expression)?
  Examples would be appreciated.
  Also, just for kicks, may I had this: I read the code of some haskell-made 
 programs and was astonished. Yes! It was clean and all, but there were dos
 everywhere... Why use a function language if you use it as an imperative
 one?(i.e. most of the apps in
 http://haskell.org/practice.html)
  

Well, most of the code is still functional in nature, only some of
it is imperative.
And even if you're writing a very IO heavy program writing IO in
Haskell is still much nicer than in traditional imperative languages
since all actions are first class citizens etc.

It's better to have a nice clean way of doing IO that's completely
separated away from pure code than to have everything be done in a
less clean imperative style always.
In Haskell you have it both ways. When a functional approach is
cleaner, use it, when stuff should be evaluated in sequence (not just
IO, but other monads like Maybe and State as well) you do that. It all
works out in a sane and clean way.

/S

-- 
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Cale Gibbard
On 13/09/05, Dhaemon [EMAIL PROTECTED] wrote:
 Hello,
  I'm quite interested in haskell, but there is something I don't
 understand(intuitively). I've been crawling the web for an answer, but
 nothing talks to me...
  So I was hoping I could find some help here:
  How is evaluating an expression different from performing action?
  I'm puzzled... Doesn't it amount to the same thing? Maybe I have a wrong
 definition of evaluating(determine the value of an expression)?
  Examples would be appreciated.
  Also, just for kicks, may I had this: I read the code of some haskell-made 
 programs and was astonished. Yes! It was clean and all, but there were dos
 everywhere... Why use a function language if you use it as an imperative
 one?(i.e. most of the apps in
 http://haskell.org/practice.html)
  
  Thanks in advance
  

It should be made clear that the only IO action which is ever actually
performed in a Haskell program is main (short of loading the code up
in an interactive environment and getting it to run other actions
separately). IO actions themselves are described in a pure functional,
referentially transparent way.

Evaluation of an expression is different from performing an IO action
in the various things which can occur as a result. Essentially the
only thing which should be able to occur (without some major cheating)
as the result of evaluating a Haskell expression, is the production of
a value, and this value will always be the same for a given
expression. It should not print things to the screen, fire packets
over the network, read from the random number generator or read or
write to files. (There are instances where IO is lazily delayed until
a result is demanded, so that evaluation of what looks like a pure
list results in reading from a file, but one can only construct these
situations so that they occur inside the execution of an IO action
anyway. The lists aren't really pure.)

The upshot of this is that if one has a Haskell expression, within
time and memory constraints, one can evaluate it on any computer,
under any ordinary circumstances, and get the same result. One can't
make that claim about performing an IO action. IO actions when
performed may read from the keyboard or network or filesystem (as well
as write to the screen, etc.). However, evaluation of an expression
which represents an IO action always yields the same action (even if
that action may not do the same thing when it is actually performed in
the end). That's the distinction that's being made.

As it has been pointed out in other posts, do notation is pure, in the
sense that do blocks are expressions which evaluate to the same thing
every time. This thing may be an IO action, but it may also be a list,
a Maybe value, a binary tree, a function of type s - (a, s) (called a
state computation), a graph, or any number of other monadic types.
Most monads m are not one-way in that one can extract results from
the monadic containers - there usually exist functions (m a - a) --
IO is a major example of a case where this doesn't hold, but it's by
far not the only example of a monad.

 - Cale
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Cale Gibbard
On 13/09/05, Dhaemon [EMAIL PROTECTED] wrote:
 Hello,
  I'm quite interested in haskell, but there is something I don't
 understand(intuitively). I've been crawling the web for an answer, but
 nothing talks to me...
  So I was hoping I could find some help here:
  How is evaluating an expression different from performing action?
  I'm puzzled... Doesn't it amount to the same thing? Maybe I have a wrong
 definition of evaluating(determine the value of an expression)?
  Examples would be appreciated.
  Also, just for kicks, may I had this: I read the code of some haskell-made 
 programs and was astonished. Yes! It was clean and all, but there were dos
 everywhere... Why use a function language if you use it as an imperative
 one?(i.e. most of the apps in
 http://haskell.org/practice.html)
  
  Thanks in advance
  

It should be made clear that the only IO action which is ever actually
performed in a Haskell program is main (short of loading the code up
in an interactive environment and getting it to run other actions
separately). IO actions themselves are described in a pure functional,
referentially transparent way.

Evaluation of an expression is different from performing an IO action
in the various things which can occur as a result. Essentially the
only thing which should be able to occur (without some major cheating)
as the result of evaluating a Haskell expression, is the production of
a value, and this value will always be the same for a given
expression. It should not print things to the screen, fire packets
over the network, read from the random number generator or read or
write to files. (There are instances where IO is lazily delayed until
a result is demanded, so that evaluation of what looks like a pure
list results in reading from a file, but one can only construct these
situations so that they occur inside the execution of an IO action
anyway. The lists aren't really pure.)

The upshot of this is that if one has a Haskell expression, within
time and memory constraints, one can evaluate it on any computer,
under any ordinary circumstances, and get the same result. One can't
make that claim about performing an IO action. IO actions when
performed may read from the keyboard or network or filesystem (as well
as write to the screen, etc.). However, evaluation of an expression
which represents an IO action always yields the same action (even if
that action may not do the same thing when it is actually performed in
the end). That's the distinction that's being made.

As it has been pointed out in other posts, do notation is pure, in the
sense that do blocks are expressions which evaluate to the same thing
every time. This thing may be an IO action, but it may also be a list,
a Maybe value, a binary tree, a function of type s - (a, s) (called a
state computation), a graph, or any number of other monadic types.
Most monads m are not one-way in that one can extract results from
the monadic containers - there usually exist functions (m a - a) --
IO is a major example of a case where this doesn't hold, but it's by
far not the only example of a monad.

 - Cale
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] some algorithm help with jhc

2005-09-13 Thread John Meacham
I have started working on jhc more recently and have come across some
places where I think my algorithms could be improved but was not sure
exactly where to start so thought I would ask the list since perhaps
someone here has some insight.

After a long time of trying various methods of speeding up the fixpoint
iteration of my points-to analysis (the current main bottleneck) I
decided to step back and look at the basic problem again. It turns out I
can express the problem as one of constraint satisfaction resulting in
much smaller code (600 lines vs 2000) and 10fold speedups with my
unoptimized first draft solver.

It is much faster but still not as fast as I'd like. I don't know a lot
about constraint problems, but my intuiton says this particular problem
is of a type that should be particularly easy to solve but am uncertain
where to start in my searching to find a fast algorithm. My constraints
come in two types of rules.

the rules are of the form (where a and b are variables to be solved for and x 
and y are values in my domain)

 * a = f(b)  where x = y implies f(x) = f(y)
 * enforce g(a) as a new set of rules  where if x = y then g(x) subsumes g(y)
 

f and g are typed thusly.
f :: domain - domain
g :: domain - set of rules

the following useful derived rules can be expressed by the above.
a = b
a == b
if z(a) then b = c


now, the reason my intuiton says there should be a fast solution is that
there is no way for the variables to decrease. every added rule can only
add to the least solution and not shrink any set.

so, my basic question is, is this a known form of constraint
satisfaction problem? does it admit a particulary fast solution as my
intuition tells me? does it have a name I can search for on
scholar.google.com?

my current first draft implementation represents each rule as an IO
action taking a difference set that propegates said difference set and
then adds it to the current set for each var.


The second problem I am facing is one of debugging. my code dealing with
jhc core and all the optimizations that are performed on it has gone
through a lot of evolution. over time, bugs have been introduced that
are very hard to track down, the symptom would be suddenly having core
that doesn't typecheck or has an unknown identifier or worse a segfault
in the generated program. backtracking to find the error is quite
tedious, mainly involving commenting out transformations until I find
the offending one, then rederiving the correct code and comparing it to
what I have written. 

I have decided to remedy the situation and start using QuickCheck to
verify all my transformations are meaning and type preserving. however,
the problem arrises in how to come up with a meaningful instance of
Arbitrary for expressions in jhc core. It is not clear at all how to
come up with code that generates random yet interesting, well typed,
convergent, terms in the extended lambda calculus with things like
recursive definitons and primitives. even if I solved that, the problem
of deciding whether two expressions (which might be functions) do the
'same thing' is undecidable, so how do I even test if the
transformations are meaning preserving?  Ideally, someone would have
written a paper on this. I have seen several papers on generating
suitable random graphs for testing graph algorithms, but have not come
across one on creating typed lambda calculus terms. perhaps someone else
has come across this same problem and has some insights?

I am interested in ideas, brainstorming and pointers to papers or terms
to search for as much as ready made solutions. In any case, I think they
are interesting problems to begin with... hopefully someone out there
thinks so too :)

John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional vs Imperative

2005-09-13 Thread Cale Gibbard
I apologise for the duplicate messages -- GMail was having issues, and
told me that the message couldn't be sent the first time I'd attempted
it.
 - Cale
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe