[Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-06 Thread tphyahoo

Very, very helpful Chris; thanks; and thanks also to the many other helpful
haskellers.

 They have (hopefully working) cabal files to make compiling and installing
 ea\
sy.

Unfortunately, not so easy, for PCRE.regex. But hopefully this is just due
to my ignorance and there's a simple workaround.

At any rate, after darcs --getting as you suggested, I ran make, and got
various complaints. I installed haddock, happy, alex, hat, c2hs, and cpphs
with apt-get.

But was unable to find a deb repository for greencard, the final requirement
with apt-cache search.

I then downloaded the latest version of greencard 

wget http://www.haskell.org/greencard/downloads/greencard-latest-src.tar.gz

and ran sudo make install install-pkg

It chugged along for a while, but finally errored out with

ghc -package-name greencard -cpp -fglasgow-exts -fno-prune-tydecls  -prof -c
Foreign/GreenCard.hs -o Foreign/GreenCard.p_o -hisuf p_hi
ghc-6.4.1: unrecognised flags: -fno-prune-tydecls

I then googled, but found nothing for no-prune-tydecls or no-prune-typedecls
(thinking it might be a typo)

Anybody out there can help me get greencard working, so I (and all us
perlers) can start using PCRE from haskell?

thomas.

Chris wrote: 
 I think if you paste the subRegex code above underneath an import
 Text.Posix.PCRE declaration then you get what you are looking for.

 To install:

 The regex-* package hosting is via darcs and has been copied/moved to

 http://darcs.haskell.org/packages/   (The stable regex-* versions)
 http://darcs.haskell.org/packages/regex-unstable/  (The unstable regex-*
 vers\
ions)

 so darcs get --partial http://darcs.haskell.org/packages/regex-pcre;
 might b\
e
 useful.

 They have (hopefully working) cabal files to make compiling and installing
 ea\
sy.
  Note that regex-pcre and regex-tre need libpcre and libtre to be
 installed
 separately.  regex-posix needs a posix library, but GHC already provides
 this
 package with a working libary.


-- 
View this message in context: 
http://www.nabble.com/trivial-function-application-question-tf2922232.html#a8192328
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] GHC performance of 64-bit

2007-01-06 Thread Duncan Coutts
On Fri, 2007-01-05 at 17:51 +, Pedro Baltazar Vasconcelos wrote:
 
 Hello all,
 
 I noticed that GHC generates slower code on an Linux amd64 bit platform than 
 the 32-bit version on a cheaper 32-bit machine.
 CPUTime for running sieve of Erathostenes to generate 10,000 primes:
 Athlon XP 2800 (32-bit): 7.98 secs
 Athlon 64 3800 (64-bit): 10.29 secs
 This is using GHC 6.6 on the 64-bit machine and 6.4.1 on the 32-bit one.
 
 I googled around and could not find any information regarding degraded 
 performance of ghc/haskell on 64-bit machines. Any ideas?

I would suggest re-running that with GHC 6.6. x86-64 support was only
really added in GHC 6.4.1 (in 6.4 it only worked for really simple
programs).

However some general info: memory usage is mostly doubled as every
pointer and integer goes from 4 to 8 bytes.

Duncan

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


Re: [Haskell-cafe] GHC performance of 64-bit

2007-01-06 Thread Tomasz Zielonka
On Sat, Jan 06, 2007 at 10:31:08AM +, Duncan Coutts wrote:
 On Fri, 2007-01-05 at 17:51 +, Pedro Baltazar Vasconcelos wrote:
  Athlon XP 2800 (32-bit): 7.98 secs
  Athlon 64 3800 (64-bit): 10.29 secs
  This is using GHC 6.6 on the 64-bit machine and 6.4.1 on the 32-bit one.
  ^

 I would suggest re-running that with GHC 6.6. x86-64 support was only
 really added in GHC 6.4.1 (in 6.4 it only worked for really simple
 programs).

He can only switch to 6.6 on the 32-bit machine, so the difference can
only get bigger :-)

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


Re: [Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-06 Thread Chris Kuklewicz
tphyahoo wrote:
 Very, very helpful Chris; thanks; and thanks also to the many other helpful
 haskellers.
 
 They have (hopefully working) cabal files to make compiling and installing
 ea\
 sy.
 
 Unfortunately, not so easy, for PCRE.regex. But hopefully this is just due
 to my ignorance and there's a simple workaround.

I think that it is simpler than you think.  Cabal is confusing you.

 At any rate, after darcs --getting as you suggested, I ran make, and got
 various complaints. I installed haddock, happy, alex, hat, c2hs, and cpphs
 with apt-get.

Well, the Makefile is just sugar for the Cabal Setup.hs file.

Running --configure notices that many things are not installed, but this is just
noise from Cabal.

With my development directory I get this output from ./setup --configure:

 Configuring regex-pcre-0.80...
 configure: /usr/local/bin/ghc-pkg
 configure: Dependency base=2.0: using base-2.0
 configure: Dependency regex-base-any: using regex-base-0.71
 configure: Using install prefix: /usr/local
 configure: Binaries installed in: /usr/local/bin
 configure: Libraries installed in: /usr/local/lib/regex-pcre-0.80/ghc-6.6
 configure: Private binaries installed in: /usr/local/libexec
 configure: Data files installed in: /usr/local/share/regex-pcre-0.80
 configure: Using compiler: /usr/local/bin/ghc
 configure: Compiler flavor: GHC
 configure: Compiler version: 6.6
 configure: Using package tool: /usr/local/bin/ghc-pkg
 configure: Using ar found on system at: /usr/bin/ar
 configure: Using haddock found on system at: /usr/local/bin/haddock
 configure: No pfesetup found
 configure: Using ranlib found on system at: /usr/bin/ranlib
 configure: Using runghc found on system at: /usr/local/bin/runghc
 configure: No runhugs found
 configure: No happy found
 configure: No alex found
 configure: Using hsc2hs: /usr/local/bin/hsc2hs
 configure: No c2hs found
 configure: No cpphs found
 configure: No greencard found

This is sufficient to compile regex-pcre so long as you also have libpcre where
ghc will find it.  The main this is that it found ghc-6.6 and the hsc2hs and
ghc-pkg that came with ghc.

Specifically commands to run:

make setup  # this means Setup.hs is compiled once into setup for speed
./setup --configure -p --user --prefix=/where/you/want/it
./setup build
./setup install --user
./setup clean

If you really want it to be global, then remove the --user and --prefix and
install with sudo.

Also, ./setup --help is useful.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Redefining superclass default methods in a subclass

2007-01-06 Thread Brian Hulley

Bulat Ziganshin wrote:

Hello Brian,

Thursday, January 4, 2007, 10:00:05 PM, you wrote:


deeper, the programmer is burdened more and more by the need to
cut-and-paste method definitions between instances because Haskell
doesn't allow a superclass (or ancestor class) method default to be
redefined in a subclass.


i've runned into this problem with Streams library. finally i've
decided to wrote bodies of such methods outside of class:

[example snipped]

Hello Bulat,

Thanks for the workaround, which solves the need to copy and paste method 
bodies though not the problem of having to write out instance decls for a 
potentially large chain of classes leading to the subclass of interest. Part 
of the motivation for proposing that a superclass method default could be 
redefined in a subclass (or a particular instance) is that it would allow 
some refactorings of the class hierarchy without affecting code that just 
uses the subclass - in particular it would allow existing code using Monad 
to compile unchanged even when Monad moved down to Functor = Applicative = 
Monad because return and = are enough to get completely defined instances 
for Functor and Applicative.


Best regards, Brian.
--
http://www.metamilk.com 


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


Re: [Haskell-cafe] Stupid newbie question

2007-01-06 Thread Brian Hulley

Brian Hurt wrote:

nth 0 (x:xs) = Some x
nth i (x:xs) = if i  0 then Empty else nth (i-1) xs
nth i [] = Empty

[blows stack on large i]

As other people have pointed out, this is due to laziness. I'd write it 
like:


   nth 0 (x:_) = Some x
   nth i (_:xs) = of i  0 then Empty else (nth $! i-1) xs
   nth _ [] = Empty

where a general rule of thumb is always to replace (fun intexp) by (fun $! 
intexp) whenever intexp is just a trivial arithmetic expression that doesn't 
involve traversing (ie forcing of) any other data structure.


Brian.
--
http://www.metamilk.com 


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


Re: [Haskell-cafe] Stupid newbie question

2007-01-06 Thread Brian Hulley

Brian Hulley wrote:

Brian Hurt wrote:

nth 0 (x:xs) = Some x
nth i (x:xs) = if i  0 then Empty else nth (i-1) xs
nth i [] = Empty

[blows stack on large i]

As other people have pointed out, this is due to laziness. I'd write
it like:

   nth 0 (x:_) = Some x
   nth i (_:xs) = of i  0 then Empty else (nth $! i-1) xs

  ^^^ -- oops!


   nth _ [] = Empty


I think the above code would be more efficient written as:

   nth n xs = if n  0 then Empty else nth' n xs
   where
   nth' 0 (x:_) = Some x
   nth' i (_:xs) = (nth' $! i - 1) xs
   nth' _ _ = Empty

since the first 2 cases deal with every situation where we've got a 
non-empty list and an index = 0 (so no need to keep checking that the index 
is = 0 in the second case - instead the test can be moved outside the 
loop) and there's no need to pattern match against [] in the last case 
because we already know this must be an empty list.
(Though in general it's probably a good idea to make each pattern as 
independent as possible when writing a function so that if some cases of a 
function are later edited there's more chance of the compiler being able to 
lead you to errors via the incomplete patterns warning - hopefully the 
compiler can optimize out any redundant checks)


Brian.
--
http://www.metamilk.com 


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


Re: [Haskell-cafe] Stupid newbie question

2007-01-06 Thread Brian Hulley

Brian Hulley wrote:

Brian Hulley wrote:

Brian Hurt wrote:

nth 0 (x:xs) = Some x
nth i (x:xs) = if i  0 then Empty else nth (i-1) xs
nth i [] = Empty

[blows stack on large i]

As other people have pointed out, this is due to laziness. I'd write
it like:

   nth 0 (x:_) = Some x
   nth i (_:xs) = of i  0 then Empty else (nth $! i-1) xs

  ^^^ -- oops!


   nth _ [] = Empty


Actually I see I should have read Jeremy Shaw's answer more carefully before 
giving my own since I'd missed the point about the problem being with the 
list itself not the decrementing of (i) (which wouldn't be a problem since 
it is immediately forced on the next iteration by the comparison of i to 0).


The answer therefore lies in the laziness of the makelist function which 
could be solved by:


   makelist i = i : (makelist $! i - 1)

Jeremy Shaw wrote:

pps. I didn't explain why [1..100] works, but [1..] fails, because
I don't know :) It's a bit suprising to me...


I think this might be because the code that produces the list [1..100] 
would have to be something like:


   produce n i = if i  n then i : produce n (i +1) else []

so each element of the list is now forced by the comparison with n, so even 
though the end of the list will be a thunk when 100 has not yet been 
reached, none of the elements are thunks.


Anyway it was certainly not a stupid question - thanks for asking it.

Best regards, Brian.
--
http://www.metamilk.com 


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


Re: [Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-06 Thread David House

On 06/01/07, Chris Kuklewicz [EMAIL PROTECTED] wrote:

Running --configure notices that many things are not installed, but this is just
noise from Cabal.


This is the second time I've seen someone get confused by these
messages. I propose we add a 'Configuration successful, now type
runhaskell Setup.hs build.' to the bottom of the configure output.

--
-David House, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] trouble installing ghc 6.6: xargs: /usr/bin/ar: terminated by signal 11

2007-01-06 Thread tphyahoo

I'm having trouble installing ghc 6.6. On ubuntu, virtual server (user mode
linux).

Something seems to be killing the process, no idea why.

Anyone seen this? 

I looked around with ps to see if anything looked suspicious. I do have a
lot of screens open, but I don't see why that should matter. There is no
instance of haskell or gnci running.

after running configure with no problem.

~$ cd ghc-6.6/
~/ghc-6.6$ sudo make makeOut
Password:
~/ghc-6.6$ tail -n8 makeOut
(echo Control/Concurrent_stub.o System/CPUTime_hsc.o System/Time_hsc.o ;
/usr/bin/find Control/Applicative_split Control/Arrow_split
Control/Concurrent_split Control/Concurrent/Chan_split 
...long mess...
Text/PrettyPrint/HughesPJ_split Text/Printf_split Text/Read_split
Text/Read/Lex_split Text/Show_split Text/Show/Functions_split -name '*.o'
-print) | xargs /usr/bin/ar q libHSbase.a
/usr/bin/ar: creating libHSbase.a
xargs: /usr/bin/ar: terminated by signal 11
make[2]: *** [libHSbase.a] Error 125
make[2]: *** Deleting file `libHSbase.a'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/thartman/ghc-6.6/libraries'
make: *** [stage1] Error 2
~/ghc-6.6$

-- 
View this message in context: 
http://www.nabble.com/trouble-installing-ghc-6.6%3A-xargs%3A--usr-bin-ar%3A-terminated-by-signal-11-tf2932856.html#a8199860
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] trouble installing ghc 6.6: xargs: /usr/bin/ar: terminated by signal 11

2007-01-06 Thread Stefan O'Rear
On Sat, Jan 06, 2007 at 03:30:56PM -0800, tphyahoo wrote:
 
 I'm having trouble installing ghc 6.6. On ubuntu, virtual server (user mode
 linux).
 
 Something seems to be killing the process, no idea why.
 
 Anyone seen this? 
 
 xargs: /usr/bin/ar: terminated by signal 11
 make[2]: *** [libHSbase.a] Error 125
 make[2]: *** Deleting file `libHSbase.a'
 make[1]: *** [all] Error 1
 make[1]: Leaving directory `/home/thartman/ghc-6.6/libraries'
 make: *** [stage1] Error 2
 ~/ghc-6.6$

Is it repeatable?  i.e. If you run 'make' again, do you get the same error at
the same place?  If you answer 'no', swap out all your RAM and try again.
Unexplained sig11's are the classic first symptom of failing memory, soon 
followed
by filesystem corruption and data loss.  I wish I'd paid attention when I had my
first weird crash. :(

(there are other possibilities, but they usually won't be fixed by replacing the
memory and usually will be repeatable.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] trouble installing ghc 6.6: xargs: /usr/bin/ar: terminated by signal 11

2007-01-06 Thread Jeremy Shaw
At Sat, 6 Jan 2007 15:41:37 -0800,
Stefan O'Rear wrote:
 
 On Sat, Jan 06, 2007 at 03:30:56PM -0800, tphyahoo wrote:
  
  I'm having trouble installing ghc 6.6. On ubuntu, virtual server (user mode
  linux).

 Is it repeatable?  i.e. If you run 'make' again, do you get the same error at
 the same place?  If you answer 'no', swap out all your RAM and try again.
 Unexplained sig11's are the classic first symptom of failing memory, soon 
 followed
 by filesystem corruption and data loss.  I wish I'd paid attention when I had 
 my
 first weird crash. :(

In my experience bad memory causing signal 11 can even be very repeatable.

If you haven't tried a memory test yet, memtest86 and its derivatives
are a good place to start. memtest86, memtest86+, and a bunch of other
hardware diagnostics can be found on this (free as in beer) cd:

http://www.ultimatebootcd.com/

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


Re: [Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-06 Thread Donald Bruce Stewart
dmhouse:
 On 06/01/07, Chris Kuklewicz [EMAIL PROTECTED] wrote:
 Running --configure notices that many things are not installed, but this 
 is just
 noise from Cabal.
 
 This is the second time I've seen someone get confused by these
 messages. I propose we add a 'Configuration successful, now type
 runhaskell Setup.hs build.' to the bottom of the configure output.

I agree. This issue is even mentioned here:


www.serpentine.com/blog/2007/01/05/getting-started-with-installing-third-party-haskell-packages/

Those new to Cabal always seem to assume things are going badly when
happy not found. We need to address the psychological aspect
of Cabal's config process :)

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


Re: [Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-06 Thread Ross Paterson
On Sun, Jan 07, 2007 at 12:44:46PM +1100, Donald Bruce Stewart wrote:
 dmhouse:
  On 06/01/07, Chris Kuklewicz [EMAIL PROTECTED] wrote:
  Running --configure notices that many things are not installed, but this 
  is just noise from Cabal.
  
  This is the second time I've seen someone get confused by these
  messages. I propose we add a 'Configuration successful, now type
  runhaskell Setup.hs build.' to the bottom of the configure output.
 
 I agree. This issue is even mentioned here:
 
 
 www.serpentine.com/blog/2007/01/05/getting-started-with-installing-third-party-haskell-packages/
 
 Those new to Cabal always seem to assume things are going badly when
 happy not found. We need to address the psychological aspect
 of Cabal's config process :)

But it's not enough to just say Ignore any errors above.  Some packages
really do need happy (or some other tool) to build.  Cabal would need to
crawl over the source files to see what preprocessors are really needed.
(It does that in the build phase, but not configure.)  If haddock is
absent, you can build and install, but not build documentation.

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


Re: [Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-06 Thread David Menendez
Donald Bruce Stewart writes:

 dmhouse:
  This is the second time I've seen someone get confused by these
  messages. I propose we add a 'Configuration successful, now type
  runhaskell Setup.hs build.' to the bottom of the configure output.
 
 I agree. This issue is even mentioned here:
 
 

www.serpentine.com/blog/2007/01/05/getting-started-with-installing-third
-party-haskell-packages/
 
 Those new to Cabal always seem to assume things are going badly when
 happy not found. We need to address the psychological aspect
 of Cabal's config process :)

Perhaps it would be better not to print the missing component messages
by default. There could be a verbose option to turn them back on.

-- 
David Menendez [EMAIL PROTECTED] | In this house, we obey the laws
http://www.eyrie.org/~zednenem  |of thermodynamics!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-06 Thread Marco Túlio Gontijo e Silva
Em Dom, 2007-01-07 às 02:07 +, Ross Paterson escreveu:
 On Sun, Jan 07, 2007 at 12:44:46PM +1100, Donald Bruce Stewart wrote:
  dmhouse:
   On 06/01/07, Chris Kuklewicz [EMAIL PROTECTED] wrote:
   Running --configure notices that many things are not installed, but this 
   is just noise from Cabal.
   
   This is the second time I've seen someone get confused by these
   messages. I propose we add a 'Configuration successful, now type
   runhaskell Setup.hs build.' to the bottom of the configure output.
  
  I agree. This issue is even mentioned here:
  
  
  www.serpentine.com/blog/2007/01/05/getting-started-with-installing-third-party-haskell-packages/
  
  Those new to Cabal always seem to assume things are going badly when
  happy not found. We need to address the psychological aspect
  of Cabal's config process :)
 
 But it's not enough to just say Ignore any errors above.  Some packages
 really do need happy (or some other tool) to build.  Cabal would need to
 crawl over the source files to see what preprocessors are really needed.
 (It does that in the build phase, but not configure.)  If haddock is
 absent, you can build and install, but not build documentation.

Maybe if in the Cabal file was specified what's needed for compiling the
package, this would not happen.

-- 
malebria
Marco Túlio Gontijo e Silva
Correio (MSN): [EMAIL PROTECTED]
Jabber (GTalk): [EMAIL PROTECTED]
Telefone: 33346720
Celular: 98116720
Endereço:
  Rua Paula Cândido, 257/201
  Gutierrez 30430-260
  Belo Horizonte/MG Brasil

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