Re: [GHC] #2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)

2008-10-21 Thread GHC
#2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)
--+-
 Reporter:  ravi  |  Owner:
 Type:  bug   | Status:  new   
 Priority:  normal|  Milestone:
Component:  GHCi  |Version:  6.10.1
 Severity:  critical  | Resolution:
 Keywords:| Difficulty:  Unknown   
 Testcase:|   Architecture:  x86_64 (amd64)
   Os:  Linux |  
--+-
Changes (by simonpj):

  * difficulty:  = Unknown

Comment:

 Can you give us a test case?  Without that it's hard to help.  Or are you
 saying that simply typing ghci eats 1.5G?  That ''would'' be strange.

 Many thanks

 Simon

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2716#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)

2008-10-21 Thread GHC
#2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)
--+-
 Reporter:  ravi  |  Owner:
 Type:  bug   | Status:  new   
 Priority:  normal|  Milestone:
Component:  GHCi  |Version:  6.10.1
 Severity:  critical  | Resolution:
 Keywords:| Difficulty:  Unknown   
 Testcase:|   Architecture:  x86_64 (amd64)
   Os:  Linux |  
--+-
Comment (by duncan):

 We have seen this kind behaviour before with older ghc releases.
 Superficially it looks similar to this report: #778 or
 http://bugs.gentoo.org/show_bug.cgi?id=135651 That time it was caused by a
 newer gcc mis-compiling some part of the RTS.

 Ravi: could you get an strace log of starting ghci and attach it to this
 ticket. Could you also attach the output of `emerge --info`. That would
 help us, thanks.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2716#comment:2
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)

2008-10-21 Thread GHC
#2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)
--+-
 Reporter:  ravi  |  Owner:
 Type:  bug   | Status:  new   
 Priority:  high  |  Milestone:  6.10.1
Component:  GHCi  |Version:  6.10.1
 Severity:  critical  | Resolution:
 Keywords:| Difficulty:  Unknown   
 Testcase:|   Architecture:  x86_64 (amd64)
   Os:  Linux |  
--+-
Changes (by simonmar):

  * priority:  normal = high
  * milestone:  = 6.10.1

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2716#comment:3
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #2717: Add nubWith, nubOrd

2008-10-21 Thread GHC
#2717: Add nubWith, nubOrd
-+--
Reporter:  Bart Massey   |   Owner:  
Type:  proposal  |  Status:  new 
Priority:  normal|   Component:  libraries/base  
 Version:|Severity:  normal  
Keywords:|Testcase:  
Architecture:  Unknown/Multiple  |  Os:  Unknown/Multiple
-+--
 This is a followup to my proposal #2629, which had a much more ambitious
 scheme.  After much discussion, it was decided to put this smaller
 proposal on the table.

 I've implemented a new function Data.List.nubWith that takes a stop list
 and filtering function as an argument, and filters its target list
 against the stop list. I've then implemented Data.Set.nubOrd in terms of
 nubWith. nubBy is left alone, since there's nothing obvious to be done
 about it. All of the nubs are still fully lazy.

 Basic QuickCheck tests have been written, and pass.
 Performance benchmarking shows my nubOrd implementation to be quite
 comparable to that of nub in cases where the latter performs well, and
 dramatically faster when nub performs poorly. In particular, nubOrd can
 work on long lists with long nubs, unlike the basic nub, which is
 hopeless.

 Patch against current Darcs head attached.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2717
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2717: Add nubWith, nubOrd

2008-10-21 Thread GHC
#2717: Add nubWith, nubOrd
-+--
Reporter:  Bart Massey   |Owner:  
Type:  proposal  |   Status:  new 
Priority:  normal|Milestone:  
   Component:  libraries/base|  Version:  
Severity:  normal|   Resolution:  
Keywords:| Testcase:  
Architecture:  Unknown/Multiple  |   Os:  Unknown/Multiple
-+--
Comment (by Bart Massey):

 Discussion period two weeks, until 2008/11/3.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2717#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2629: Data.List: Replace nub; add nubOrd, nubInt, nubWith

2008-10-21 Thread GHC
#2629: Data.List: Replace nub; add nubOrd, nubInt, nubWith
--+-
 Reporter:  Bart Massey   |  Owner:  
 Type:  proposal  | Status:  closed  
 Priority:  normal|  Milestone:  Not GHC 
Component:  libraries/base|Version:  
 Severity:  minor | Resolution:  invalid 
 Keywords:| Difficulty:  Unknown 
 Testcase:|   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Changes (by Bart Massey):

  * status:  new = closed
  * resolution:  = invalid

Comment:

 Superseded by proposal #2717 .

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2629#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1364: Finalizers not guaranteed to run before the program exits

2008-10-21 Thread GHC
#1364: Finalizers not guaranteed to run before the program exits
--+-
 Reporter:  [EMAIL PROTECTED]  |  Owner:  simonmar
 Type:  feature request   | Status:  new 
 Priority:  normal|  Milestone:  6.10.1  
Component:  Runtime System|Version:  6.6.1   
 Severity:  normal| Resolution:  
 Keywords:| Difficulty:  Moderate (1 day)
 Testcase:|   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Comment (by Svarog):

 Replying to [comment:15 simonmar]:

 Yes, you are right. I've rewritten the patches from scratch and hopefully
 the new patches address all the problems.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1364#comment:17
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2714: No match in record selector Var.tcTyVarDetails

2008-10-21 Thread GHC
#2714: No match in record selector Var.tcTyVarDetails
-+--
Reporter:  morrow|Owner:
  
Type:  bug   |   Status:  new   
  
Priority:  normal|Milestone:
  
   Component:  Compiler (Type checker)   |  Version:  6.10.1
  
Severity:  normal|   Resolution:
  
Keywords:  Var, tcTyVarDetails, record selector  | Testcase:
  
Architecture:  Unknown/Multiple  |   Os:  
Unknown/Multiple
-+--
Comment (by morrow):

 Judging from the comment, this may have
 something to do with it? From TcUnify:

 {{{
 unBox :: BoxyType - TcM TcType
 -- ...
 unBox (TyVarTy tv)
   | isTcTyVar tv-- It's a boxy type
 variable
   , MetaTv BoxTv ref - tcTyVarDetails tv   -- NB: non-TcTyVars are
 possible
   = do  { cts - readMutVar ref -- under nested
 quantifiers
 -- ...
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2714#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1475: Adding imports and exports with Template Haskell

2008-10-21 Thread GHC
#1475: Adding imports and exports with Template Haskell
--+-
 Reporter:  igloo |  Owner:  
 Type:  feature request   | Status:  new 
 Priority:  normal|  Milestone:  _|_ 
Component:  Template Haskell  |Version:  6.8.2   
 Severity:  normal| Resolution:  
 Keywords:| Difficulty:  Unknown 
 Testcase:|   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Changes (by morrow):

 * cc: [EMAIL PROTECTED] (added)

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1475#comment:9
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1895: Allow aliases in GHCi module imports

2008-10-21 Thread GHC
#1895: Allow aliases in GHCi module imports
--+-
 Reporter:  tibbe |  Owner:  
 Type:  feature request   | Status:  new 
 Priority:  normal|  Milestone:  6.10 branch 
Component:  GHCi  |Version:  6.8.1   
 Severity:  normal| Resolution:  
 Keywords:| Difficulty:  Unknown 
 Testcase:|   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Changes (by morrow):

 * cc: [EMAIL PROTECTED] (added)

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1895#comment:13
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1365: -fbyte-code is ignored in a OPTIONS_GHC pragma

2008-10-21 Thread GHC
#1365: -fbyte-code is ignored in a OPTIONS_GHC pragma
--+-
 Reporter:  mnislaih  |  Owner:  
 Type:  feature request   | Status:  new 
 Priority:  normal|  Milestone:  6.10 branch 
Component:  GHCi  |Version:  6.6.1   
 Severity:  minor | Resolution:  
 Keywords:| Difficulty:  Moderate (1 day)
 Testcase:|   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Changes (by morrow):

 * cc: [EMAIL PROTECTED] (added)

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1365#comment:11
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2714: No match in record selector Var.tcTyVarDetails

2008-10-21 Thread GHC
#2714: No match in record selector Var.tcTyVarDetails
-+--
Reporter:  morrow|Owner:
  
Type:  bug   |   Status:  new   
  
Priority:  normal|Milestone:
  
   Component:  Compiler (Type checker)   |  Version:  6.10.1
  
Severity:  normal|   Resolution:
  
Keywords:  Var, tcTyVarDetails, record selector  | Testcase:
  
Architecture:  Unknown/Multiple  |   Os:  
Unknown/Multiple
-+--
Comment (by morrow):

 I just came across ticket #1123, which seems possibly related.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2714#comment:2
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #1496: Newtypes and type families combine to produce inconsistent FC(X) axiom sets

2008-10-21 Thread GHC
#1496: Newtypes and type families combine to produce inconsistent FC(X) axiom 
sets
-+--
 Reporter:  sorear   |  Owner:  simonpj 
 Type:  bug  | Status:  new 
 Priority:  normal   |  Milestone:  6.10 branch 
Component:  Compiler (Type checker)  |Version:  6.7 
 Severity:  critical | Resolution:  
 Keywords:   | Difficulty:  Unknown 
 Testcase:   |   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple |  
-+--
Changes (by morrow):

 * cc: [EMAIL PROTECTED] (added)

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1496#comment:19
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)

2008-10-21 Thread GHC
#2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)
--+-
 Reporter:  ravi  |  Owner:
 Type:  bug   | Status:  new   
 Priority:  high  |  Milestone:  6.10.1
Component:  GHCi  |Version:  6.10.1
 Severity:  critical  | Resolution:
 Keywords:| Difficulty:  Unknown   
 Testcase:|   Architecture:  x86_64 (amd64)
   Os:  Linux |  
--+-
Comment (by igloo):

 Someone else had this problem, but upgrading libedit fixed it. We think
 (but haven't verified) that this Debian patch is what fixes the problem:
 {{{
  06-fgetln.c-error.diff by Ben Burton [EMAIL PROTECTED]

  Routine fgetln() was behaving incorrectly on error (such as when
  EOF was reached), which in turn caused infinite memory consumption
  during read_history().

 --- a/glibc-bsd-glue/fgetln.c
 +++ a/glibc-bsd-glue/fgetln.c
 @@ -5,9 +5,10 @@
  {
 char *line=NULL;

 -   getline (line, len, stream);
 -
 -   (*len)--; /* get rid of the trailing \0, fgetln
 -   does not have it */
 -   return line;
 +   if (getline (line, len, stream) = 0) {
 +   (*len)--; /* get rid of the trailing \0, fgetln
 +   does not have it */
 +   return line;
 +   } else
 +   return NULL;
  }
 }}}
 Can someone take a look to see if Gentoo's libedit looks buggy please?

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2716#comment:4
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2697: bad testsuite results with ghc-6.10.0.20081007

2008-10-21 Thread GHC
#2697: bad testsuite results with ghc-6.10.0.20081007
--+-
 Reporter:  maeder|  Owner:  
 Type:  bug   | Status:  new 
 Priority:  high  |  Milestone:  6.10.1  
Component:  Compiler  |Version:  6.9 
 Severity:  normal| Resolution:  
 Keywords:| Difficulty:  Unknown 
 Testcase:|   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Comment (by maeder):

 fixing my CPATH and LD_LIBRARY_PATH on our ppc Mac 10.4 leaves 155
 unexpected failures:
 http://www.informatik.uni-
 
bremen.de/agbkb/forschung/formal_methods/CoFI/hets/mac/ghcs/ghc-6.10.0.20081007-tests.log2.bz2

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2697#comment:4
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2693: Type Synonym Family Panic in GHC 6.10.0.20081007

2008-10-21 Thread GHC
#2693: Type Synonym Family Panic in GHC 6.10.0.20081007
--+-
 Reporter:  BenMoseley|  Owner:  chak
 Type:  merge | Status:  reopened
 Priority:  normal|  Milestone:  
Component:  Compiler  |Version:  6.9 
 Severity:  major | Resolution:  
 Keywords:  panic | Difficulty:  Unknown 
 Testcase:  T2693 |   Architecture:  x86 
   Os:  Unknown/Multiple  |  
--+-
Changes (by simonpj):

  * status:  closed = reopened
  * type:  bug = merge
  * resolution:  fixed =

Comment:

 Ian pls merge
 {{{
 Tue Oct 21 05:01:07 PDT 2008  Manuel M T Chakravarty
 [EMAIL PROTECTED]
   * FIX #2693
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2693#comment:5
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2693: Type Synonym Family Panic in GHC 6.10.0.20081007

2008-10-21 Thread GHC
#2693: Type Synonym Family Panic in GHC 6.10.0.20081007
--+-
 Reporter:  BenMoseley|  Owner:  igloo  
 Type:  merge | Status:  new
 Priority:  normal|  Milestone: 
Component:  Compiler  |Version:  6.9
 Severity:  major | Resolution: 
 Keywords:  panic | Difficulty:  Unknown
 Testcase:  T2693 |   Architecture:  x86
   Os:  Unknown/Multiple  |  
--+-
Changes (by simonpj):

  * status:  reopened = new
  * owner:  chak = igloo

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2693#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2688: GHC 6.10.0.20081007 hangs instead of giving error about missing type class constraint

2008-10-21 Thread GHC
#2688: GHC 6.10.0.20081007 hangs instead of giving error about missing type 
class
constraint
--+-
 Reporter:  PVerswyvelen  |  Owner:  chak
 Type:  merge | Status:  reopened
 Priority:  high  |  Milestone:  6.10.1  
Component:  Compiler  |Version:  6.11
 Severity:  major | Resolution:  
 Keywords:| Difficulty:  Unknown 
 Testcase:  T2688 |   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Changes (by simonpj):

  * status:  closed = reopened
  * type:  bug = merge
  * resolution:  fixed =

Comment:

 Fixed by
 {{{
 Mon Oct 20 21:42:13 PDT 2008  Manuel M T Chakravarty
 [EMAIL PROTECTED]
   * FIX #2688
 }}}
 Pls merge

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2688#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #2718: Building ghc-6.8.3 with ghc-6.2.2 failed on Red Hat 7.3 machine

2008-10-21 Thread GHC
#2718: Building ghc-6.8.3 with ghc-6.2.2 failed on Red Hat 7.3 machine
---+
Reporter:  jputcu  |   Owner:  
Type:  bug |  Status:  new 
Priority:  normal  |   Component:  Build System
 Version:  6.8.3   |Severity:  blocker 
Keywords:  |Testcase:  
Architecture:  x86 |  Os:  Linux   
---+
 I'm trying to compile ghc-6.8.3 on an old Red Hat 7.3 system.

 Using an older ghc-6.2.2 compiler I configure:
 {{{
  ./configure --with-ghc=/opt/ghc/ghc-6.2.2/bin/ghc
 --prefix=/opt/ghc/ghc-6.8.3
 ...
 }}}

 I make:
 {{{
  make
 ...
 /opt/ghc/ghc-6.2.2/bin/ghc -H16m -O  -istage1/utils  -istage1/basicTypes
 -istage1/types  -istage1/hsSyn  -istage1/prelude  -istage1/rename
 -istage1/typecheck  -istage1/deSugar  -istage1/coreSyn  -istage1/vectorise
 -istage1/specialise  -istage1/simplCore  -istage1/stranal  -istage1/stgSyn
 -istage1/simplStg  -istage1/codeGen  -istage1/main  -istage1/profiling
 -istage1/parser  -istage1/cprAnalysis  -istage1/ndpFlatten  -istage1/iface
 -istage1/cmm  -istage1/nativeGen -Wall -fno-warn-name-shadowing -Istage1
 -cpp -fglasgow-exts -fno-generics -Rghc-timing -I. -Iparser -package unix
 -recomp -Rghc-timing  -H16M '-#include cutils.h' -DUSING_COMPAT
 -i../compat -package unix-c typecheck/TcBinds.lhs -o
 stage1/typecheck/TcBinds.o  -ohi stage1/typecheck/TcBinds.hi

 typecheck/TcBinds.lhs:523:
 Couldn't match
 `BoxyType - TcM a' against `TcM (HsWrapper, MatchGroup TcId)'
 Expected type: BoxyType - TcM a
 Inferred type: TcM (HsWrapper, MatchGroup TcId)
 Probable cause: `tcMatchesFun' is applied to too many arguments in the
 call
 (tcMatchesFun name inf matches)
 In the first argument of `tcInfer', namely
 `(tcMatchesFun name inf matches)'

 typecheck/TcBinds.lhs:672:
 Couldn't match `TcM (HsWrapper, MatchGroup TcId)' against `t - t1'
 Expected type: TcM (HsWrapper, MatchGroup TcId)
 Inferred type: t - t1
 Probable cause: `tcMatchesFun' is applied to too many arguments in the
 call
 (tcMatchesFun (idName mono_id) inf matches (idType mono_id))
 In a 'do' expression:
 (co_fn, matches') - tcMatchesFun (idName mono_id)
   inf
   matches
   (idType mono_id)
 ghc: 239363224 bytes, 226 GCs, 7917634/20950144 avg/max bytes residency
 (6 samples), 39M in use, 0.00 INIT (0.00 elapsed), 0.48 MUT (1.04
 elapsed), 0.34 GC (0.55 elapsed) :ghc
 make[1]: *** [stage1/typecheck/TcBinds.o] Error 1
 make: *** [stage1] Error 1
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2718
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)

2008-10-21 Thread GHC
#2716: ghci uses an enormous amount of memory (recent 6.10 snapshots)
--+-
 Reporter:  ravi  |  Owner:
 Type:  bug   | Status:  closed
 Priority:  high  |  Milestone:  6.10.1
Component:  GHCi  |Version:  6.10.1
 Severity:  critical  | Resolution:  invalid   
 Keywords:| Difficulty:  Unknown   
 Testcase:|   Architecture:  x86_64 (amd64)
   Os:  Linux |  
--+-
Changes (by ravi):

  * status:  new = closed
  * resolution:  = invalid

Comment:

 From looking at source, the Gentoo libedit version I was using (dev-
 libs/libedit-20050930) appears to have the bug. I upgraded to Gentoo's
 dev-libs/libedit-20061103-r2, but it has the same problem. Applying the
 referenced patch solved the issue.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2716#comment:5
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2718: Building ghc-6.8.3 with ghc-6.2.2 failed on Red Hat 7.3 machine

2008-10-21 Thread GHC
#2718: Building ghc-6.8.3 with ghc-6.2.2 failed on Red Hat 7.3 machine
-+--
Reporter:  jputcu|Owner:   
Type:  bug   |   Status:  new  
Priority:  normal|Milestone:   
   Component:  Build System  |  Version:  6.8.3
Severity:  blocker   |   Resolution:   
Keywords:| Testcase:   
Architecture:  x86   |   Os:  Linux
-+--
Changes (by jputcu):

 * cc: [EMAIL PROTECTED] (added)

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2718#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2698: Windows binary distribution pops up README.TXT for the source distribution

2008-10-21 Thread GHC
#2698: Windows binary distribution pops up README.TXT for the source 
distribution
--+-
 Reporter:  ganesh|  Owner:  igloo  
 Type:  bug   | Status:  closed 
 Priority:  high  |  Milestone:  6.10.1 
Component:  Compiler  |Version:  6.9
 Severity:  minor | Resolution:  fixed  
 Keywords:| Difficulty:  Unknown
 Testcase:|   Architecture:  x86
   Os:  Windows   |  
--+-
Changes (by igloo):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 Fixed in HEAD and 6.10:
 {{{
 Tue Oct 21 17:25:43 BST 2008  Ian Lynagh [EMAIL PROTECTED]
   * Don't put the README file in the Windows installer; fixes trac #2698
   The README file talks about getting and building the sources, which
   doesn't make sense for the installer.
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2698#comment:3
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2703: Buffer overflow, occasional segfaults when using handles created by Network.

2008-10-21 Thread GHC
#2703: Buffer overflow, occasional segfaults when using handles created by
Network.
---+
 Reporter:  sclv   |  Owner:  igloo 
 Type:  merge  | Status:  closed
 Priority:  high   |  Milestone:  6.10.1
Component:  libraries/network  |Version:  6.8.3 
 Severity:  normal | Resolution:  fixed 
 Keywords: | Difficulty:  Unknown   
 Testcase: |   Architecture:  x86_64 (amd64)
   Os:  Linux  |  
---+
Changes (by igloo):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 Merged

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2703#comment:3
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2688: GHC 6.10.0.20081007 hangs instead of giving error about missing type class constraint

2008-10-21 Thread GHC
#2688: GHC 6.10.0.20081007 hangs instead of giving error about missing type 
class
constraint
--+-
 Reporter:  PVerswyvelen  |  Owner:  igloo   
 Type:  merge | Status:  closed  
 Priority:  high  |  Milestone:  6.10.1  
Component:  Compiler  |Version:  6.11
 Severity:  major | Resolution:  fixed   
 Keywords:| Difficulty:  Unknown 
 Testcase:  T2688 |   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Changes (by igloo):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 Merged

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2688#comment:8
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2693: Type Synonym Family Panic in GHC 6.10.0.20081007

2008-10-21 Thread GHC
#2693: Type Synonym Family Panic in GHC 6.10.0.20081007
--+-
 Reporter:  BenMoseley|  Owner:  igloo  
 Type:  merge | Status:  closed 
 Priority:  normal|  Milestone: 
Component:  Compiler  |Version:  6.9
 Severity:  major | Resolution:  fixed  
 Keywords:  panic | Difficulty:  Unknown
 Testcase:  T2693 |   Architecture:  x86
   Os:  Unknown/Multiple  |  
--+-
Changes (by igloo):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 Merged

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2693#comment:7
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #2711: haddock contents/index includes hidden modules (broken links)

2008-10-21 Thread GHC
#2711: haddock contents/index includes hidden modules (broken links)
--+-
 Reporter:  igloo |  Owner:  
 Type:  bug   | Status:  closed  
 Priority:  high  |  Milestone:  6.10.1  
Component:  Documentation |Version:  6.8.3   
 Severity:  normal| Resolution:  fixed   
 Keywords:| Difficulty:  Unknown 
 Testcase:|   Architecture:  Unknown/Multiple
   Os:  Unknown/Multiple  |  
--+-
Changes (by igloo):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 Fixed by:
 {{{
 Mon Oct 20 22:13:24 BST 2008  David Waern [EMAIL PROTECTED]
   * Do not save hidden modules in the .haddock file
 }}}
 {{{
 Tue Oct 21 20:54:52 BST 2008  David Waern [EMAIL PROTECTED]
   * Do not save hidden modules in the .haddock file (also for ghc = 6.9)
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2711#comment:2
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #2720: eyeball/inline1 still isn't optimised with -fno-method-sharing

2008-10-21 Thread GHC
#2720: eyeball/inline1 still isn't optimised with -fno-method-sharing
-+--
Reporter:  rl|   Owner:  
Type:  run-time performance bug  |  Status:  new 
Priority:  normal|   Component:  Compiler
 Version:  6.10.1|Severity:  normal  
Keywords:|Testcase:  
Architecture:  Unknown/Multiple  |  Os:  Unknown/Multiple
-+--
 Just as a reminder: `eyeball/inline1.hs` isn't optimised properly if
 `-fno-method-sharing` is set after this patch:
 {{{
 Tue Sep  9 08:50:11 PDT 2008  [EMAIL PROTECTED]
  * Important performance wibble to callSiteInline (the n_vals_wanted  0
 thing)
 }}}
 This affects DPH code quite a bit.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2720
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #2721: Newtype deriving doesn't work with type families

2008-10-21 Thread GHC
#2721: Newtype deriving doesn't work with type families
-+--
Reporter:  rl|   Owner:  
Type:  bug   |  Status:  new 
Priority:  normal|   Component:  Compiler
 Version:  6.10.1|Severity:  normal  
Keywords:|Testcase:  
Architecture:  Unknown/Multiple  |  Os:  Unknown/Multiple
-+--
 This assumes `-XTypeFamiles -XGeneralizedNewtypeDeriving`. Example:
 {{{
 class C a where
   type T a
   foo :: a - T a

 instance C Int where
   type T Int = Int
   foo = id

 newtype N = N Int deriving(C)
 }}}
 This happily produces an `instance C N` but no `type instance T N`. It
 should either (preferably) generate
 {{{
 type instance T N = Int
 }}}
 or fail. The example also compiles if `T` is a data family (the `Int`
 instance needs to be change accordingly). It should probably fail in this
 case.

 BTW, this also compiles fine, with rather dramatic consequences:
 {{{
 type family T a
 class C a where
   foo :: a - T a

 type instance T Int = Int
 instance C Int where
   foo = id

 type instance T N = Double
 newtype N = N Int deriving(C)
 }}}
 I guess this last example is the same bug as `#1496`. I wonder if the
 deriving clause could generate something like:
 {{{
 instance T Int ~ T N = C Int
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2721
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: cabal

2008-10-21 Thread Christian Maeder
Duncan Coutts wrote:
 The basic problem here is that the version number of the network package
 has not been bumped.

see below

 You probably installed from a ghc bindist that has
 network-2.2.0.0 already,

Yes, you're right, and I didn't notice that, because I relied on cabal
install.

 however it's not the same as network-2.2.0.0
 from hackage. The pre-installed one is built against base-4, so when
 cabal-install tries to rebuild it then it tries to build it against base
 4 which does not work because the one on hackage has not been updated.

So network-2.2.0.0 should be linked against base-3 within the binary
dist of ghc-6.10 (or not shipped with ghc-6.10 at all.

In fact it worked after I've unregistered my global network-2.2.0.0,
first! (but I didn't get much further, see below)

 Normally cabal-install would use base-3 but in this case it's picking 4
 because the version that is already installed used 4 so the assumption
 is that since the same version is already installed then it does indeed
 work with base 4. Of course that's not true here because the package has
 changed without the version being bumped.

Or cabal-install should be smarter (or less smart).

 Indeed the only reason it's trying to rebuild it at all is because the
 installed version has different deps from the available version, again
 due to the fact that it changed without changing version number.
 
 So the solution is for the updated network package to have its version
 bumped and for it to be released.

So why is the version of network not bumped, yet? The maintainer is
[EMAIL PROTECTED] Would it interfere with ghc-6.8?

Cheers and thanks for your explanation
Christian

P.S. for hxt and Shellac-editline the sources need to be changed for
ghc-6.10:

[ 49 of 112] Compiling Text.XML.HXT.RelaxNG.DataTypeLibUtils (
src/Text/XML/HXT/RelaxNG/DataTypeLibUtils.hs,
dist/build/Text/XML/HXT/RelaxNG/DataTypeLibUtils.o )

src/Text/XML/HXT/RelaxNG/DataTypeLibUtils.hs:67:7:
`' is not a (visible) method of class `Arrow'
cabal: Error: some packages failed to install:
hxt-8.1.0 failed during the building phase. The exception was:
exit: ExitFailure 1

Building Shellac-editline-0.9...
[1 of 1] Compiling System.Console.Shell.Backend.Editline (
src/System/Console/Shell/Backend/Editline.hs,
dist/build/System/Console/Shell/Backend/Editline.o )

src/System/Console/Shell/Backend/Editline.hs:48:45:
Couldn't match expected type `()' against inferred type `Bool'
  Expected type: IO ()
  Inferred type: IO Bool
In the expression: EL.readHistory
In the `readHistory' field of a record
cabal: Error: some packages failed to install:
Shellac-editline-0.9 failed during the building phase. The exception was:
exit: ExitFailure 1

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


Re: [Haskell] Probably a trivial thing for people knowing Haskell

2008-10-21 Thread Friedrich
Udo Stenzel [EMAIL PROTECTED] writes:

 Friedrich wrote:
 Ok to  be more concrete is the laziness hidden here?
 
 check_line line sum count =  
 let match = matchRegex regexp line
 in case match of
Just strs - (sum + read (head strs) :: Integer, count + 1)
Nothing - (sum, count)

 Yes, part of it.  To see why, put yourself into the role of an evaluator
 for your program.  An application of check_line will not be evaluated
 until necessary, and it becomes necessary only if the result is bound to
 a pattern (and that binding is needed for some reason).  At that point,
 enough has to be evaluated to determine whether the result is actually a
 pair or bottom.

 So what will you do?  The body of check_line is a case expression, so
 you need to sufficiently evaluate its scrutinee.  You evaluate enough of
 matchRegex to see whether the result is Nothing or Just.  Let's say it's
 Just.  So you descent into the Just branch, and you see the result is a
 pair (and not bottom).  The elements of the pair have not been
 evaluated, there was no need to.  Also, the arguments to check_line have
 not been evaluated, except for line.

 You need to force the evaluation of the elements of the result pair
 whenever the pair itself is demanded, for example:

 check_line line sum count =  
 let match = matchRegex regexp line
 in case match of
Just strs - ((,) $! (sum + read (head strs) :: Integer)) $! 
  count + 1
Nothing - ((,) $! sum) $! count)

 (The associativity of ($!) is inconvenient here.  I want
 left-associative ($!).  Actually, a strict pair type would be even more
 convenient here.)

 On recent GHC with bang-patterns, this short-cut works, too.  It's not
 quite equivalent, because it will create unevaluated thunks, though they
 won't pile up:

 check_line line !sum !count =  
 let match = matchRegex regexp line
 in case match of
Just strs - (sum + read (head strs) :: Integer, count + 1)
Nothing - (sum, count)

Ok, I followed the suggestions. Now I have the following code:

module Main where
import System
import System.IO
import System.Directory
import System.IO.Error
import Text.Regex
import Control.Monad

regexp = mkRegex (([0-9]+) Windows ex)

main = do
   files - show_dir [0-9].*
   (sum,count) - run_on_all_files (0,0) files
   let dd = (fromIntegral (sum::Integer))/ (fromIntegral (count::Int))
   in
putStr(Download =  ++ show sum ++  in  ++ show count ++  days 
are  ++ show dd ++  downloads/day\n) 




run_on_all_files (a,b) [] = return (a,b)
run_on_all_files (a,b) (x:xs) = do (s,c) - run_on(a,b) x
   run_on_all_files (s,c) xs


run_on (a,b) file_name = do
handle - openFile file_name ReadMode
(sum,count) - for_each_line (a,b) handle
hClose handle
return ((sum,count))
  
for_each_line (sum, count) handle = do
   l - try (hGetLine handle)
   case l of
  Left err 
  | isEOFError err - return(sum,count)
  | otherwise - ioError err
  Right line  - do 
 let (nsum, ncount) = 
count_downloads line (sum, count) 
 for_each_line (nsum,ncount) handle 

   
  
count_downloads line (!sum, !count) =  
let match = matchRegex regexp line
in case match of
   Just strs - (sum + read (head strs) :: Integer, count + 1)
   Nothing - (sum, count)



show_dir regmatch = do   
files - getDirectoryContents .
let reg = mkRegex regmatch in
  return(filter (\file_name - let fm = matchRegex 
reg file_name
  in case fm of
  Just strs - True
  Nothing - False) files)




But it still  sucks  memor as wild and more or less crashes the
system. So why's that  than?

Regards
Friedrich

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


Re: [Haskell] Probably a trivial thing for people knowing Haskell

2008-10-21 Thread Friedrich
Udo Stenzel [EMAIL PROTECTED] writes:

 Friedrich wrote:
 Ok to  be more concrete is the laziness hidden here?
 
 check_line line sum count =  
 let match = matchRegex regexp line
 in case match of
Just strs - (sum + read (head strs) :: Integer, count + 1)
Nothing - (sum, count)

 Yes, part of it.  To see why, put yourself into the role of an evaluator
 for your program.  An application of check_line will not be evaluated
 until necessary, and it becomes necessary only if the result is bound to
 a pattern (and that binding is needed for some reason).  At that point,
 enough has to be evaluated to determine whether the result is actually a
 pair or bottom.

 So what will you do?  The body of check_line is a case expression, so
 you need to sufficiently evaluate its scrutinee.  You evaluate enough of
 matchRegex to see whether the result is Nothing or Just.  Let's say it's
 Just.  So you descent into the Just branch, and you see the result is a
 pair (and not bottom).  The elements of the pair have not been
 evaluated, there was no need to.  Also, the arguments to check_line have
 not been evaluated, except for line.

 You need to force the evaluation of the elements of the result pair
 whenever the pair itself is demanded, for example:

 check_line line sum count =  
 let match = matchRegex regexp line
 in case match of
Just strs - ((,) $! (sum + read (head strs) :: Integer)) $! 
  count + 1
Nothing - ((,) $! sum) $! count)

 (The associativity of ($!) is inconvenient here.  I want
 left-associative ($!).  Actually, a strict pair type would be even more
 convenient here.)

 On recent GHC with bang-patterns, this short-cut works, too.  It's not
 quite equivalent, because it will create unevaluated thunks, though they
 won't pile up:

 check_line line !sum !count =  
 let match = matchRegex regexp line
 in case match of
Just strs - (sum + read (head strs) :: Integer, count + 1)
Nothing - (sum, count)

Ok, I followed the suggestions. Now I have the following code:

module Main where
import System
import System.IO
import System.Directory
import System.IO.Error
import Text.Regex
import Control.Monad

regexp = mkRegex (([0-9]+) Windows ex)

main = do
   files - show_dir [0-9].*
   (sum,count) - run_on_all_files (0,0) files
   let dd = (fromIntegral (sum::Integer))/ (fromIntegral (count::Int))
   in
putStr(Download =  ++ show sum ++  in  ++ show count ++  days 
are  ++ show dd ++  downloads/day\n) 




run_on_all_files (a,b) [] = return (a,b)
run_on_all_files (a,b) (x:xs) = do (s,c) - run_on(a,b) x
   run_on_all_files (s,c) xs


run_on (a,b) file_name = do
handle - openFile file_name ReadMode
(sum,count) - for_each_line (a,b) handle
hClose handle
return ((sum,count))
  
for_each_line (sum, count) handle = do
   l - try (hGetLine handle)
   case l of
  Left err 
  | isEOFError err - return(sum,count)
  | otherwise - ioError err
  Right line  - do 
 let (nsum, ncount) = 
count_downloads line (sum, count) 
 for_each_line (nsum,ncount) handle 

   
  
count_downloads line (!sum, !count) =  
let match = matchRegex regexp line
in case match of
   Just strs - (sum + read (head strs) :: Integer, count + 1)
   Nothing - (sum, count)



show_dir regmatch = do   
files - getDirectoryContents .
let reg = mkRegex regmatch in
  return(filter (\file_name - let fm = matchRegex 
reg file_name
  in case fm of
  Just strs - True
  Nothing - False) files)




But it still  sucks  memor as wild and more or less crashes the
system. So why's that  than?

Regards
Friedrich

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


[Haskell] Re: Probably a trivial thing for people knowing Haskell

2008-10-21 Thread apfelmus
Friedrich wrote:
 Paul Johnson writes:

 -- Concatenate all the files into one big string.  File reading is
 lazy, so this won't take all the memory.
 getAllFiles :: [String] - IO String
 getAllFiles paths = do
   contents - mapM getFile paths
   return $ concat contents

 Then use lines to split the result into individual lines and process
 them using filter, map and foldr.  Because file reading is lazy,
 each line is only read when it is to be processed, and then gets
 reaped by the garbage collector.  So it all runs in constant memory.

 Would you mind to elaborate a bit about it. What's so terrible to open
 one file after the other, reading it line by line and close the file
 thereafter.

It's not beautiful.

Here's a more idiomatic version

{-# LANGUAGE BangPatterns #-}
module Main where

import Control.Monad
import System.Directory
import Text.Regex
import Data.List
import Data.Maybe

main = do
files - filter_reg [0-9].* `liftM` getDirectoryContents .
(sum,count) - sumcount `liftM` mapM run_file files
let dd = fromIntegral sum / fromIntegral count
putStrLn $ Download =  ++ show sum
++  in  ++ show count
++  days are  ++ show dd ++  downloads/day

sumcount :: [(Integer,Int)] - (Integer,Int)
sumcount = foldl' (\(!s,!c) (ds,dc) - (s+ds,c+dc)) (0,0)

run_file name =
(sumcount . map check_line . lines) `liftM` readFile' name

readFile' name = unsafeInterleaveIO $
openFile name ReadMode = hGetContents

regexp = mkRegex ([0-9]+) Windows ex
check_line line = case matchRegex regexp line of
Just (s:_) - (read s,1)
Nothing- (0,0)

filter_reg pat = let reg = mkRegex pat in
filter $ isJust . matchRegex reg


It's much shorter and should run in constant memory as well.



Regards,
apfelmus

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


Re: [Haskell] Re: Probably a trivial thing for people knowing Haskell

2008-10-21 Thread Friedrich
the posted codes runs in constant memory, so  yes that make it
possible that the stuff runs. That's really nice. Howerver the time is
drastically bad

Even the ruby solution need just 
check_downloads/check_downloads.rb .  1,25s user 0,06s system 99% cpu
1,322 total

Here's the ruby code
#!/usr/bin/ruby

sum = 0;
count = 0;
if (ARGV[0]) then
Dir.chdir(ARGV[0])
else
Dir.chdir(Mail/Administration)
end
Dir[[0-9]*].each { |file |
  fh = File.open(file)
while line = fh.gets
  if line =~ /(\d+) Windows executable/
num = $1.to_i
#log.printf(file_name = %s, num = %d\n, file, num);
sum += num
count += 1
  end
end
  fh.close

}

printf(%d downloads in %d days = %.2f downlaods/day, sum, count, 
Float(sum)/count)
   

but the haskell  solution:
./chk_dwlds  17,71s user 0,11s system 99% cpu 17,836 total

Ruby is surely not the speed king of scripting languages, but what
Haskell delivers is way worse

Howerver at least it doesn not crash any longer

Regards
Friedrich



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


Re: [Haskell] Re: Probably a trivial thing for people knowing Haskell

2008-10-21 Thread Ketil Malde
Friedrich [EMAIL PROTECTED] writes:

 Even the ruby solution need just 
 check_downloads/check_downloads.rb .  1,25s user 0,06s system 99% cpu
 1,322 total
   [...]
 but the haskell  solution:
 ./chk_dwlds  17,71s user 0,11s system 99% cpu 17,836 total

I'm very surprised to see this.  Did you profile it to see what takes
so long?

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] Re: Probably a trivial thing for people knowing Haskell

2008-10-21 Thread Friedrich
Well I never have tried to profile here's my first try. 
I compiled with

ghc --make -O -prof -auto-all chk_dwlds.hs


I've run the program with:
./chk_dwlds \+RTS -p \-RTS

and got this .prof file
Tue Oct 21 15:01 2008 Time and Allocation Profiling Report  (Final)

   chk_dwlds +RTS -p -RTS

total time  =   19.62 secs   (981 ticks @ 20 ms)
total alloc = 19,090,366,024 bytes  (excludes profiling overheads)

COST CENTREMODULE   %time %alloc

run_file   Main  67.2   96.5
check_line Main  31.52.5
sumcount   Main   1.31.0



   individualinherited
COST CENTRE  MODULE   
no.entries  %time %alloc   %time %alloc

MAIN MAIN   
1   0   0.00.0   100.0  100.0
 mainMain 
238   1   0.00.0   100.0  100.0
  sumcount   Main 
242   1   0.00.0 0.00.0
  run_file   Main 
2411764  67.2   96.5   100.0  100.0
   check_lineMain 
244 1944781  31.52.531.52.5
   sumcount  Main 
2431764   1.31.0 1.31.0
  main   Main 
247   0   0.00.0 0.00.0
   filter_regMain 
248   0   0.00.0 0.00.0
 CAF Main 
232  10   0.00.0 0.00.0
  check_line Main 
246   2   0.00.0 0.00.0
  regexp Main 
245   1   0.00.0 0.00.0
  main   Main 
239   0   0.00.0 0.00.0
   filter_regMain 
240   2   0.00.0 0.00.0
 CAF Text.Read.Lex
209   8   0.00.0 0.00.0
 CAF GHC.Read 
204   1   0.00.0 0.00.0
 CAF GHC.Float
203   3   0.00.0 0.00.0
 CAF GHC.Int  
198   1   0.00.0 0.00.0
 CAF GHC.Handle   
184   7   0.00.0 0.00.0
 CAF System.Posix.Internals   
168   7   0.00.0 0.00.0
 CAF System.Directory 
125   1   0.00.0 0.00.0

Regards
Friedrich

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


RE: [Haskell] Probably a trivial thing for people knowing Haskell

2008-10-21 Thread Simon Peyton-Jones
Folks,

I wonder if this worthwhile thread could move from haskell@haskell.org to 
[EMAIL PROTECTED]

The main Haskell list, haskell@haskell.org, is a low-bandwidth list for 
discussion starters and announcements.  The Haskell Cafe, by contrast, is a 
high-bandwidth list for detailed discussion.

We don't want to force subscribers to the main Haskell list to unsubscribe.

Thanks

Simon

| -Original Message-
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
| Behalf Of Friedrich
| Sent: 21 October 2008 08:18
| To: haskell@haskell.org
| Subject: Re: [Haskell] Probably a trivial thing for people knowing Haskell
|
| Udo Stenzel [EMAIL PROTECTED] writes:
|
|  Friedrich wrote:
|  Ok to  be more concrete is the laziness hidden here?
|  
|  check_line line sum count =
|  let match = matchRegex regexp line
|  in case match of
| Just strs - (sum + read (head strs) :: Integer, count +
| 1)
| Nothing - (sum, count)
| 
|  Yes, part of it.  To see why, put yourself into the role of an evaluator
|  for your program.  An application of check_line will not be evaluated
|  until necessary, and it becomes necessary only if the result is bound to
|  a pattern (and that binding is needed for some reason).  At that point,
|  enough has to be evaluated to determine whether the result is actually a
|  pair or bottom.
| 
|  So what will you do?  The body of check_line is a case expression, so
|  you need to sufficiently evaluate its scrutinee.  You evaluate enough of
|  matchRegex to see whether the result is Nothing or Just.  Let's say it's
|  Just.  So you descent into the Just branch, and you see the result is a
|  pair (and not bottom).  The elements of the pair have not been
|  evaluated, there was no need to.  Also, the arguments to check_line have
|  not been evaluated, except for line.
| 
|  You need to force the evaluation of the elements of the result pair
|  whenever the pair itself is demanded, for example:
| 
|  check_line line sum count =
|  let match = matchRegex regexp line
|  in case match of
| Just strs - ((,) $! (sum + read (head strs) :: Integer))
| $! count + 1
| Nothing - ((,) $! sum) $! count)
| 
|  (The associativity of ($!) is inconvenient here.  I want
|  left-associative ($!).  Actually, a strict pair type would be even more
|  convenient here.)
| 
|  On recent GHC with bang-patterns, this short-cut works, too.  It's not
|  quite equivalent, because it will create unevaluated thunks, though they
|  won't pile up:
| 
|  check_line line !sum !count =
|  let match = matchRegex regexp line
|  in case match of
| Just strs - (sum + read (head strs) :: Integer, count +
| 1)
| Nothing - (sum, count)
|
| Ok, I followed the suggestions. Now I have the following code:
|
| module Main where
| import System
| import System.IO
| import System.Directory
| import System.IO.Error
| import Text.Regex
| import Control.Monad
|
| regexp = mkRegex (([0-9]+) Windows ex)
|
| main = do
|files - show_dir [0-9].*
|(sum,count) - run_on_all_files (0,0) files
|let dd = (fromIntegral (sum::Integer))/ (fromIntegral (count::Int))
|in
| putStr(Download =  ++ show sum ++  in  ++ show count ++ 
| days are  ++ show dd ++  downloads/day\n)
|
|
|
|
| run_on_all_files (a,b) [] = return (a,b)
| run_on_all_files (a,b) (x:xs) = do (s,c) - run_on(a,b) x
|run_on_all_files (s,c) xs
|
|
| run_on (a,b) file_name = do
| handle - openFile file_name ReadMode
| (sum,count) - for_each_line (a,b) handle
| hClose handle
| return ((sum,count))
|
| for_each_line (sum, count) handle = do
|l - try (hGetLine handle)
|case l of
|   Left err
|   | isEOFError err - return(sum,count)
|   | otherwise - ioError err
|   Right line  - do
|  let (nsum, ncount) =
| count_downloads line (sum, count)
|  for_each_line (nsum,ncount)
| handle
|
|
|
| count_downloads line (!sum, !count) =
| let match = matchRegex regexp line
| in case match of
|Just strs - (sum + read (head strs) :: Integer, count + 1)
|Nothing - (sum, count)
|
|
|
| show_dir regmatch = do
| files - getDirectoryContents .
| let reg = mkRegex regmatch in
|   return(filter (\file_name - let fm =
| matchRegex reg file_name
|   in case fm of
|   Just strs - True
|   Nothing - False) files)
|
|
|
|
| But it still  sucks  memor as wild and more or less crashes the
| system. So why's that  than?
|
| Regards
| 

[Haskell] REMINDER: Haskell Communities and Activities Report

2008-10-21 Thread Janis Voigtlaender

Dear Haskellers,

The deadline for the November 2008 edition of the Haskell Communities
and Activities Report is only ten days away. If you haven't already,
please write an entry for your new project, or update your old entry.

Please mail your entries to [EMAIL PROTECTED] in plain text or LaTeX
format. More information can be found in the original Call for
Contributions at:

http://www.haskell.org/pipermail/haskell/2008-October/020651.html

I look forward to receiving your contributions.

Thanks a lot,

Janis (current editor)

--
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:[EMAIL PROTECTED]




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


Re: [Haskell] Abusing quickcheck to check existential properties

2008-10-21 Thread Rickard Nilsson

On Sun, 19 Oct 2008 00:39:32 +0200, Norman Ramsey [EMAIL PROTECTED] wrote:


I guess what I would like is to reuse most of the mechanisms in
QuickCheck to have it say one of these two things:

  1. Found an satisfying instance after 73 tries: [gives instance]

  2. After 100 tries, could not find a satisfying instance.

Like failure, the first tells you something definite about your
program.  And like passing 100 tests, the second tells you nothing.


In ScalaCheck (QuickCheck for Scala, www.scalacheck.org) there is
an exists combinator which naively tries to find a value
satisfying the property. So you can do the following:


  val p = exists(arbitrary[Int])( n = (n  0) == (n+n == n*n) )

  scala p.check
  + OK, proved property.
   ARG_0: 2


  val q = exists(arbitrary[Int])( n = (n  10) == (n+n == n*n) )

  scala q.check
  ! Gave up after only 0 passed tests. 500 tests were discarded.


As you can see, there is a notion of proved properties in ScalaCheck,
which was introduced to support the exists method.

Of course, if the property is non-trivial ScalaCheck has a hard
time finding a proof.


Regards,
  Rickard Nilsson
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] ANNOUNCE: colour 0.0.0

2008-10-21 Thread roconnor

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/colour-0.0.0

I hope for this library to become the standard colour library for Haskell. 
Most software does not properly blend colours because they fail to 
gamma-correct the colours before blending.  Hopefully by using this 
library, Haskell programs dealing with colour blending will avoid this 
problem.


I am making an early release of my colour library to get some feedback. I 
am especially interested in getting feedback on the interfaces: should 
functions be renamed, should functions be moved, etc. Should I put black 
and white colours into Data.Colour?  Which is better form making a colour: 
(sRGB r g b) or (sRGB (r,g,b))?


Bug reports and any patches are also welcome.  Be warned, I haven't 
extensively tested this library yet.


--
Russell O'Connor  http://r6.ca/
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] Re: A heretic question

2008-10-21 Thread Benjamin L . Russell
On Tue, 21 Oct 2008 01:46:00 -0400, [EMAIL PROTECTED] wrote:

A paintbrush is easy to use, but hard to use well.

An interesting analogy.  Then, in the style of a verbal analogy exam
question:

C++ : paintbrush :: Haskell : ?

Is C++ really easy to use?

-- Benjamin L. Russell

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


[Haskell-cafe] Re: external linking traumas

2008-10-21 Thread Plareplane
Chris Dornan chris at chrisdornan.com writes:

 If I try the same with ghc:
 
   ghc test.hs  -package hsql-1.7 -package hsql-mysql-1.7 -L.
 -llibmysql
 
 with libmysql.lib copied into the same directory I get:
 
   C:\Program Files\Haskell\hsql-mysql-1.7\ghc-6.8.3/libHShsql-mysql-
 1.7.a(MySQL.o)(.text+0x748):fake: undefined reference to `mysql_init at 4'
   C:\Program Files\Haskell\hsql-mysql-1.7\ghc-6.8.3/libHShsql-mysql-
 1.7.a(MySQL.o)(.text+0x83f):fake: undefined reference to
 `mysql_real_connect at 32'
   [...]
   C:\Program Files\Haskell\hsql-mysql-1.7\ghc-6.8.3/libHShsql-mysql-
 1.7.a(MySQL.o)(.text+0x216c):fake: undefined reference to
 `mysql_stmt_affected_rows at 4'
   collect2: ld returned 1 exit status

I have a possibly distantly related problem, a clunky solution, and would
like to know if there's better advice.  I tried to compile a statically linked
binary of a program involving the X11 package:

$ ghc --make tile.hs -optl-static -optl-pthread

This gives undefined references because ghc tacks on -lX11, but not -lxcb,
-lxcb-xlib, etc.

$ ghc --make tile.hs -optl-static -optl-pthread -lXcb -lxcb-xlib ...

This gives undefined references because (I think) the resulting link arguments
aren't in the right order. So, I ended up doing

$ ghc --make tile.hs -optl-static -optl-pthread -v

Then taking the output and tacking on -lxcb, -lxcb-xlib, etc. in the right
position, running it, and then it worked.  So, perhaps you might want to look at
the output with -v and seeing if everything looks the way it should.


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


Re: [Haskell-cafe] Re: A heretic question

2008-10-21 Thread Bulat Ziganshin
Hello Benjamin,

Tuesday, October 21, 2008, 8:13:55 AM, you wrote:

 Maybe this is just me, but if I had to choose a tool, I'd choose one
 that would be easy to use well.

and what tool you choose in 80's? :)


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] Re: A heretic question

2008-10-21 Thread Colin Paul Adams
 Bulat == Bulat Ziganshin [EMAIL PROTECTED] writes:

Bulat Hello Benjamin,
Bulat Tuesday, October 21, 2008, 8:13:55 AM, you wrote:

 Maybe this is just me, but if I had to choose a tool, I'd choose one
 that would be easy to use well.

Bulat and what tool you choose in 80's? :)

A TARDIS.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re[2]: [Haskell-cafe] Re: A heretic question

2008-10-21 Thread Bulat Ziganshin
Hello Colin,

Tuesday, October 21, 2008, 12:56:30 PM, you wrote:

 Bulat and what tool you choose in 80's? :)

 A TARDIS.

and why it not ruled the world? :)


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] Haskell syntax inside QuasiQuote

2008-10-21 Thread Reiner Pope
It sounds like you're doing exactly what I'm looking for. I look forward to
more.

Reiner

On Tue, Oct 21, 2008 at 4:28 PM, Matt Morrow [EMAIL PROTECTED] wrote:

  Is there a simple way to do this, i.e. using existing libraries?

 Yes indeed. I'll be traveling over the next two days, and am shooting
 for a fully functional hackage release by mid next week.

  What I need is a Haskell expression parser which outputs values of type
  Language.Haskell.TH.Syntax.QExp, but I can't see one available in the TH
  libraries, or in the haskell-src(-exts) libraries.

 My strategy is to use the existing haskell-src-exts parser, then
 translate that AST to the TH AST.

 Once I've got settled in one place, I'll follow up with a brain dump :)

  Cheers,
  Reiner

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

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


Re: [Haskell-cafe] Re: ghc error: requested module name differs from name found in interface file

2008-10-21 Thread Bertram Felgenhauer
Larry Evans wrote:
 On 10/20/08 12:33, Larry Evans wrote:
 With a file containing:
   module Main where
  
   import Array
   import Control.Functor.Fix
 I get:
   make
   ghc -i/root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2 -c 
 catamorphism.example.hs

Yes, using -i to give paths to installed packages does not work - you
really have to tell ghc about the corresponding package.conf file,
using -package-conf file. See also

  
http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html#package-databases

   catamorphism.example.hs:19:0:
   Bad interface file: 
 /root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2/Control/Functor/Fix.hi
   Something is amiss; requested module main:Control.Functor.Fix 
 differs from name found in the interface file 
 category-extras-0.53.5:Control.Functor.Fix
   make: *** [all] Error 1

The problem is that all modules found by -i are expected to be in the
current package - which is 'main' by default. (Build tools like Cabal
specify a different package name for libraries; for example the
Control.Functor.Fix is in the 'category-extras-0.53.5' package here.)

 So, I've got to figure how to tell cabal install to install in right
 place :(

Have you tried 'cabal install --global'? To make it stick, put
'user-install: False' in root's .cabal/config file.

HTH,

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


[Haskell-cafe] code generation

2008-10-21 Thread Martin Hofmann
We try to learn functional programs from examples, but our system is not
yet ported to Haskell, though we are working on it. However, we thought
about using TH.

Do you have any pointers to papers, etc. ? You'll find our project,
system and papers here: http://www.cogsys.wiai.uni-bamberg.de/effalip/


Martin

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


Re: [Haskell-cafe] Verifying a list of properties using QuickCheck

2008-10-21 Thread Brent Yorgey
On Mon, Oct 20, 2008 at 01:29:10PM +0200, Thomas van Noort wrote:
 Hi,

 I would like to verify a list of properties using QuickCheck. Of course, I 
 can test a single property using:

 quickCheck :: Testable prop = prop - IO ()

 Then, I can check a list of properties my mapping this function over a 
 list:

 quickCheckL :: Testable prop = [prop] - IO ()
 quickCheckL = mapM_ quickCheck

 This gives me a result for each property:

 Prelude Test.QuickCheck quickCheckL [1==1,2==2]
 OK, passed 100 tests.
 OK, passed 100 tests.

 However, I would like a single result for the complete list of properties 
 instead of a result for each property. I realize that this restricts the 
 properties to be of the same type, but that isn't a problem for my 
 application.

 Did I miss a library function that provides me this functionality?

If you use QuickCheck 2, you could 'mapM quickCheckResult' over your
list of properties, and then check that all the results returned
Success.

You could also try using the HTF library [1], I seem to recall that it
has this sort of functionality baked in.

-Brent

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HTF
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] REMINDER: Haskell Communities and Activities Report

2008-10-21 Thread Janis Voigtlaender

Dear Haskellers,

The deadline for the November 2008 edition of the Haskell Communities
and Activities Report is only ten days away. If you haven't already,
please write an entry for your new project, or update your old entry.

Please mail your entries to [EMAIL PROTECTED] in plain text or LaTeX
format. More information can be found in the original Call for
Contributions at:

http://www.haskell.org/pipermail/haskell/2008-October/020651.html

I look forward to receiving your contributions.

Thanks a lot,

Janis (current editor)

--
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:[EMAIL PROTECTED]




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


RE: [Haskell-cafe] code generation

2008-10-21 Thread Mitchell, Neil

  We try to learn functional programs from examples, but our 
 system is 
  not yet ported to Haskell, though we are working on it. However, we 
  thought about using TH.
  
  Do you have any pointers to papers, etc. ? You'll find our project, 
  system and papers here: 
 http://www.cogsys.wiai.uni-bamberg.de/effalip/
 
 I've only had a quick glance at the description however it 
 looks like you should have a look at derive ( 
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/derive,
   http://www-users.cs.york.ac.uk/~ndm/derive/ ) which I think 
 tries to do a similar job.

It has similarities, but there are many differences too. I'd certainly
recommend taking a look around derive to get a feel for how to do
Template Haskell stuff, and to look at the derivation by guess thing -
see the manual, and the paper at:
http://www-users.cs.york.ac.uk/~ndm/derive/ (Deriving Generic Functions
by Example).

I think using Template Haskell for your work would fit very nicely, so
is a good choice to learn :-)

To learn Template Haskell, I recommend you look at the Haddock
documentation page:

http://hackage.haskell.org/packages/archive/template-haskell/2.2.0.0/doc
/html/Language-Haskell-TH.html

And perhaps use Hoogle and a text editor to search around the
definitions:

http://haskell.org/hoogle/?hoogle=%2BLanguage.Haskell.TH+Exp

Template Haskell is quite large, in that it defines a lot of data types,
but none of it is particularly complex.

Thanks

Neil

==
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==

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


Re: [Haskell-cafe] need help making sense of the relative indexing

2008-10-21 Thread Ryan Ingram
We represent bars by integers... we have five primitive indicators:
high, low, open, close, and volume

It looks like they are using a single implicit bar chart as the input
for the program; a bar' is just an integer reference into that chart;
the only thing you can do with a Bar is pass it to an indicator, and
the interesting bits are hardwired into the primitive indicators
(which they don't supply source for in the paper).

  -- ryan

2008/10/20 Daryoush Mehrtash [EMAIL PROTECTED]:

 I am trying to make sense of the relative indexing example used in this
 Charting Patterns on Price history paper:

 http://serv1.ist.psu.edu:8080/viewdoc/download;jsessionid=CC3DEF7277760C535FE3AB7C51A2BE90?doi=10.1.1.21.6892rep=rep1type=pdf


 In Section 3 it defines:

 type Indicator a = Bar → (Maybe a )

 Indicator takes a bar b and returns an indicator value for
 that bar. .bar is associated with five basic fields:
 high, low, open, close price, and transaction volume

 ..

 It is very common while defining indicators to use past
 values of an indicator. To support this, we have a combina-
 tor (♯) which enables relative indexing into past data. Given
 a bar (time), while an indicator, say high , evaluates to the
 high price at the bar, high ♯ n yields the high price of n th
 previous bar. (♯) is defined as follows:

 (♯) :: Indicator a → Integer → Indicator a
 ind ♯ n = λ b . ind (b − n )


 I can't figure out how (b-n) translates to n'th previous bar.  Any ideas?


 daryoush

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


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


[Haskell-cafe] Re: ghc error: requested module name differs from name found in interface file

2008-10-21 Thread Larry Evans

On 10/21/08 07:35, Bertram Felgenhauer wrote:

Larry Evans wrote:

On 10/20/08 12:33, Larry Evans wrote:

With a file containing:
  module Main where
 
  import Array
  import Control.Functor.Fix
I get:
  make
  ghc -i/root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2 -c 
catamorphism.example.hs


Yes, using -i to give paths to installed packages does not work - you
really have to tell ghc about the corresponding package.conf file,
using -package-conf file. See also

  
http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html#package-databases


  catamorphism.example.hs:19:0:
  Bad interface file: 
/root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2/Control/Functor/Fix.hi
  Something is amiss; requested module main:Control.Functor.Fix 
differs from name found in the interface file 
category-extras-0.53.5:Control.Functor.Fix

  make: *** [all] Error 1


The problem is that all modules found by -i are expected to be in the
current package - which is 'main' by default. (Build tools like Cabal
specify a different package name for libraries; for example the
Control.Functor.Fix is in the 'category-extras-0.53.5' package here.)


So, I've got to figure how to tell cabal install to install in right
place :(


Have you tried 'cabal install --global'? To make it stick, put
'user-install: False' in root's .cabal/config file.

HTH,

Bertram


THANK YOU!

I finally understand what happened.  To manually install cabal-install,
I had to change to root.  I just assumed I had to stay as root to
install category-extras.  Since the default for |cabal install| was
--user, it put the files in /root/.cabal.  I just did
|cabal install category-extras| as myself and now:
---cut here ---
module Main where

import Data.Generics.Biplate
import Control.Functor.Fix

main = do
  putStr hello world\n
---cut here---
compiles without error.  Just that one little piece of information,
that |cabal install| , by default, installs in ~/.cabal and
then enables ghc to look there for packages, would have saved
an awful lot of time :(

-regards,
Larry


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


Re: [Haskell-cafe] code generation

2008-10-21 Thread Marc Weber
On Tue, Oct 21, 2008 at 03:04:27PM +0200, Martin Hofmann wrote:
 We try to learn functional programs from examples, but our system is not
 yet ported to Haskell, though we are working on it. However, we thought
 about using TH.
 
 Do you have any pointers to papers, etc. ? You'll find our project,
 system and papers here: http://www.cogsys.wiai.uni-bamberg.de/effalip/

I've only had a quick glance at the description however it looks like
you should have a look at derive
( http://hackage.haskell.org/cgi-bin/hackage-scripts/package/derive,
  http://www-users.cs.york.ac.uk/~ndm/derive/ )
which I think tries to do a similar job.

About everything else: try haskell.org, #haskell and there is even a TH
mailinglist. You should know that you can make ghci print a lot of terms
for you. Eg put the following into your ~/.ghci file
:set -fth
:m +Language.Haskell.TH
:m +Language.Haskell.TH.Syntax
then run ghci -package template-haskell and enter

ghci: Prelude Language.Haskell.TH.Syntax Language.Haskell.TH runQ [| 
(*2) |]
result:
InfixE Nothing (VarE GHC.Num.*) (Just (LitE (IntegerL 2)))

etc.. Also note that there is the module Language.Haskell.TH.Lib which
does a lot of lifting for you automatically..

I hope this does help you getting more productive in addition to reading
some of those existing texts.

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


[Haskell-cafe] Re: A heretic question

2008-10-21 Thread Eric Willigers

Achim Schneider wrote:

What kind of things, barring coding on Haskell-less platforms and
library interfaces would you choose to do in C++?


transactional database servers
HTML renderers

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


Re: [Haskell-cafe] code generation

2008-10-21 Thread Don Stewart
zghost123:
hello, im interested in using haskell to generate code and make
little AI applications for fun..   
   
is anyone already doing this sort of thing? it would be fun to collaborate 
with people on this.   

Lots of people are generating code from Haskell.
Some useful libraries to look at:

Language.C
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/language-c
Language.X86ASM
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/harpy 
Language.JavaScript
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HJavaScript
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HJScript
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/WebBits
Language.Parrot
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HsParrot
Language.Haskell
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskell-src
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] code generation

2008-10-21 Thread Antoine Latter
2008/10/20 z ghost [EMAIL PROTECTED]:
 hello, im interested in using haskell to generate code and make
 little AI applications for fun..

 is anyone already doing this sort of thing? it would be fun to collaborate
 with people on this.


I've been doing some work with Haskell code-generation in Haskell, but
I've been using the haskell-src package to do it instead of Template
Haskell, as I've been generating whole modules at a time.

I have a bunch of convenience functions that I use over here:

http://community.haskell.org/~aslatter/code/xhb/HaskellCombinators.hs

It doesn't have a very consistent API, though.  Let me know if you
have any questions about it.

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


[Haskell-cafe] Haddock on cygwin

2008-10-21 Thread Tom Hawkins
I'm having the following issue with Haddock 2.0 and GHC 6.8.3 on cygwin:

$ haddock -o doc --html -B /cygdrive/c/Program\
Files/Haskell/ghc-6.8.3/lib Test.hs
$ haddock.exe: Can't find package.conf as \cygdrive\c\Program
Files\Haskell\ghc-6.8.3\lib\driver\package.conf.inplace

The windows install of GHC 6.8.3 does not have a
driver/package.conf.inplace in ghc-6.8.3/lib.  Any ideas?

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


[Haskell-cafe] FFI and GHCi

2008-10-21 Thread Emil Axelsson

Hi,

I'm making my first attempt at using some C code in my Haskell program. I need 
it because I have a large amount of small constant tables, and GHC takes ages to 
compile the if I use ordinary lists (and the object file gets huge). If there's 
any way of achieving this without going to C, I'd be interested to know.


My question is about how to compile a library that contains C code. At the end 
of this message is a simple example of an 'increase' function. To compile, I run


  ghc Increase.hs --make -o increase increase.c

and everything works as expected. But then when I want to load the example in 
GHCi, I need to give the object file at the command line


  ghci Increase increase.o

or I get unknown symbol `increase' when I try to run main. It feels a bit 
awkward to have to list the object files every time I want to run GHCi. Is there 
any way of avoiding that? There must be, because if I install the files as a 
Cabal library, I can fire up GHCi without mentioning any object files. But I 
don't want to go through cabal every time I want test some part of my code.


Thanks for any help,

/ Emil





increase.h:

  int increase(int x);



increase.c:

  #include increase.h

  int increase(int x) {
return x+1;
  }



Increase.hs:

  {-# INCLUDE increase.h #-}
  {-# LANGUAGE ForeignFunctionInterface #-}

  import Foreign.C

  foreign import ccall increase.h increase inc :: CInt - CInt

  main = print (inc 2, inc 20)




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


Re: [Haskell-cafe] FFI and GHCi

2008-10-21 Thread Corey O'Connor
I would think there is a command you can embed in the .ghci file that
would automate the loading of the object files. But I didn't see one
on a quick scan of the manual:
http://www.haskell.org/ghc/docs/latest/html/users_guide/ghci-dot-files.html

-Corey O'Connor



On Tue, Oct 21, 2008 at 9:10 AM, Emil Axelsson [EMAIL PROTECTED] wrote:
 Hi,

 I'm making my first attempt at using some C code in my Haskell program. I
 need it because I have a large amount of small constant tables, and GHC
 takes ages to compile the if I use ordinary lists (and the object file gets
 huge). If there's any way of achieving this without going to C, I'd be
 interested to know.

 My question is about how to compile a library that contains C code. At the
 end of this message is a simple example of an 'increase' function. To
 compile, I run

  ghc Increase.hs --make -o increase increase.c

 and everything works as expected. But then when I want to load the example
 in GHCi, I need to give the object file at the command line

  ghci Increase increase.o

 or I get unknown symbol `increase' when I try to run main. It feels a bit
 awkward to have to list the object files every time I want to run GHCi. Is
 there any way of avoiding that? There must be, because if I install the
 files as a Cabal library, I can fire up GHCi without mentioning any object
 files. But I don't want to go through cabal every time I want test some part
 of my code.

 Thanks for any help,

 / Emil



 

 increase.h:

  int increase(int x);



 increase.c:

  #include increase.h

  int increase(int x) {
return x+1;
  }



 Increase.hs:

  {-# INCLUDE increase.h #-}
  {-# LANGUAGE ForeignFunctionInterface #-}

  import Foreign.C

  foreign import ccall increase.h increase inc :: CInt - CInt

  main = print (inc 2, inc 20)

 


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

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


Re: [Haskell-cafe] Re: A heretic question

2008-10-21 Thread David Leimbach
On Mon, Oct 20, 2008 at 8:07 PM, Benjamin L. Russell [EMAIL PROTECTED]
 wrote:

 On Sun, 19 Oct 2008 23:08:06 +0200, Achim Schneider [EMAIL PROTECTED]
 wrote:

 What kind of things, barring coding on Haskell-less platforms and
 library interfaces would you choose to do in C++?
 
 I'm asking 'cos I'm learning C++ and can't get the proper motivation to
 do any program I can think of in it: If I need abstraction, I'm
 thinking Haskell or Scheme, and if I'm thinking performance, C itself
 more than suffices.
 
 Plus template programming makes me shudder because of its atrocities
 against clear and straightforward FP, but that's a different matter.
 
 Coming to think of it, a compiler from a clean syntax to C++ templates
 sounds like a fun project... which I'd do in Haskell.

 Read the following uncensored interview with Bjarne Stroustrup, the
 designer of C++, and then tell me what you think:

 An Interview with Bjarne Stroustrup
 http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html


I'm pretty sure that interview is a fake one.



 -- Benjamin L. Russell

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

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


Re: [Haskell-cafe] FFI and GHCi

2008-10-21 Thread Emil Axelsson
I thought so too, but didn't find anything that seemed to work. One thing that 
perhaps could work would be to set the -l flag from the .ghci file. But when I 
tried giving -lincrease on the command line, apparently GHC expects to find a 
file named libincrease.so, which apparently is not the same as the existing 
increase.o (I tried renaming it :) ).


/ Emil



Corey O'Connor skrev:

I would think there is a command you can embed in the .ghci file that
would automate the loading of the object files. But I didn't see one
on a quick scan of the manual:
http://www.haskell.org/ghc/docs/latest/html/users_guide/ghci-dot-files.html

-Corey O'Connor



On Tue, Oct 21, 2008 at 9:10 AM, Emil Axelsson [EMAIL PROTECTED] wrote:

Hi,

I'm making my first attempt at using some C code in my Haskell program. I
need it because I have a large amount of small constant tables, and GHC
takes ages to compile the if I use ordinary lists (and the object file gets
huge). If there's any way of achieving this without going to C, I'd be
interested to know.

My question is about how to compile a library that contains C code. At the
end of this message is a simple example of an 'increase' function. To
compile, I run

 ghc Increase.hs --make -o increase increase.c

and everything works as expected. But then when I want to load the example
in GHCi, I need to give the object file at the command line

 ghci Increase increase.o

or I get unknown symbol `increase' when I try to run main. It feels a bit
awkward to have to list the object files every time I want to run GHCi. Is
there any way of avoiding that? There must be, because if I install the
files as a Cabal library, I can fire up GHCi without mentioning any object
files. But I don't want to go through cabal every time I want test some part
of my code.

Thanks for any help,

/ Emil





increase.h:

 int increase(int x);



increase.c:

 #include increase.h

 int increase(int x) {
   return x+1;
 }



Increase.hs:

 {-# INCLUDE increase.h #-}
 {-# LANGUAGE ForeignFunctionInterface #-}

 import Foreign.C

 foreign import ccall increase.h increase inc :: CInt - CInt

 main = print (inc 2, inc 20)




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


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


Re: [Haskell-cafe] code generation

2008-10-21 Thread z ghost
Thanks for that! I don't know yet what would be the easiest way
to automatically build up haskell code (Template haskell's Exps or 
the HsDecls in your link).

Generating is only a part of what i need, though. I would like some
feedback from GHC about the generated code (to see if the expressions 
typecheck, ..)

I've been using the Hint package (which calls GHC) to typecheck 
strings http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hint
I've only managed to get it half working. Have you tried this and 
would this be the best approach?

It would  be great to get machine-readable error data back from GHC somehow (in 
stead of an error string). I don't if this is possible.



--- On Tue, 10/21/08, Antoine Latter [EMAIL PROTECTED] wrote:
From: Antoine Latter [EMAIL PROTECTED]
Subject: Re: [Haskell-cafe] code generation
To: [EMAIL PROTECTED]
Cc: haskell-cafe@haskell.org
Date: Tuesday, October 21, 2008, 3:50 PM

2008/10/20 z ghost [EMAIL PROTECTED]:
 hello, im interested in using haskell to generate code and make
 little AI applications for fun..

 is anyone already doing this sort of thing? it would be fun to collaborate
 with people on this.


I've been doing some work with Haskell code-generation in Haskell, but
I've been using the haskell-src package to do it instead of Template
Haskell, as I've been generating whole modules at a time.

I have a bunch of convenience functions that I use over here:

http://community.haskell.org/~aslatter/code/xhb/HaskellCombinators.hs

It doesn't have a very consistent API, though.  Let me know if you
have any questions about it.

-Antoine


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


[Haskell-cafe] Installing ghc + gtk2hs on linux

2008-10-21 Thread Bulat Ziganshin
Hello haskell-cafe,

i'm linux freshman

what's the simplest way to install ghc + gtk2hs on Ubuntu x86 system?

-- 
Best regards,
 Bulat  mailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] Installing ghc + gtk2hs on linux

2008-10-21 Thread Michał Pałka
Hi Bulat,

(Note, I'm not using Ubuntu) You may use the packaged versions from
Ubuntu. According to http://packages.ubuntu.org/ Hardy (which is the
current version of Ubuntu) has GHC vesion 6.8.2-2ubuntu1 and gtk2hs
version 0.9.12.1-1ubuntu2. Ubuntu package names are ghc6 and
libghc6-gtk-dev respectively. To install them you need to launch the
package manager (it's probably in the system-administration menu) and
select those packages. You might also be interested in other packages
from the ght2hs tree which are listed here:
http://packages.ubuntu.com/source/hardy/gtk2hs
Hope that helps.

Best,
Michał

On Tue, 2008-10-21 at 21:17 +0400, Bulat Ziganshin wrote:
 Hello haskell-cafe,
 
 i'm linux freshman
 
 what's the simplest way to install ghc + gtk2hs on Ubuntu x86 system?
 

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


[Haskell-cafe] Spine-lazy multiqueue

2008-10-21 Thread Luke Palmer
Hi, I need a rather strange data structure, and I can't find any
existing implementations or think of a way to implement it.  It's a
multiqueue, basically a map of queues.  The trick is that it should
be lazy in its spine and still support efficient access.  For example,
the following should hold:

  dequeue 1 (foldr (enqueue 1) empty [42..]) = Just (42, ...)

  (where dequeue :: k - QMap k v - Maybe (v, QMap k v), similarly for enqueue)

I also need a unionWith :: ([v] - [v] - [v]) - QMap k v - QMap k v
- QMap k v.

I realize that these might be some pretty tough requirements to meet.
Any pointers or original ideas?

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


Re: [Haskell-cafe] Installing ghc + gtk2hs on linux

2008-10-21 Thread Ketil Malde
Bulat Ziganshin [EMAIL PROTECTED] writes:

 what's the simplest way to install ghc + gtk2hs on Ubuntu x86 system?

Untested, but try:

  sudo apt-get install libghc6-gtk-dev 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: A heretic question

2008-10-21 Thread Achim Schneider
Benjamin L.Russell [EMAIL PROTECTED] wrote:

 Read the following uncensored interview with Bjarne Stroustrup, the
 designer of C++, and then tell me what you think:
 
 An Interview with Bjarne Stroustrup
 http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html
 
As I read it the first time (it has been posted here before) I
discovered things I dislike in C++ that I hadn't discovered yet.

I wouldn't be surprised if Bjarne actually wrote it and submitted it as
a joke.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

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


[Haskell-cafe] Re: A heretic question

2008-10-21 Thread Achim Schneider
Mauricio [EMAIL PROTECTED] wrote:

 At first, make sure you have Bjarne Stroustrup book
 (very important: last edition). If there's anything good
 in C++, it's there. Look also at his homepage:
 
 http://www.research.att.com/~bs/homepage.html
 
I got the third edition and read it a couple of times... It's not that
I'm lacking knowledge of the language, but routine and a deeper
grokking of it's essence like I have with C, Scheme, Java and I guess
also Haskell.


-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

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


[Haskell-cafe] Template Haskell

2008-10-21 Thread Andrew Coppin
If I'm understanding this correctly, Template Haskell is a way to 
auto-generate repetative Haskell source code.


The thing that worries me is... if you need to write repetative Haskell 
source code, doesn't that mean that Haskell itself is broken in the 
first place?


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


Re: [Haskell-cafe] Spine-lazy multiqueue

2008-10-21 Thread Justin Bailey
On Tue, Oct 21, 2008 at 11:43 AM, Luke Palmer [EMAIL PROTECTED] wrote:
 Hi, I need a rather strange data structure, and I can't find any
 existing implementations or think of a way to implement it.  It's a
 multiqueue, basically a map of queues.  The trick is that it should
 be lazy in its spine and still support efficient access.  For example,
 the following should hold:


This doesn't answer your question, but how is a Map of queues not
spine-lazy? I'm mostly looking to understand that term.

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


Re[2]: [Haskell-cafe] Installing ghc + gtk2hs on linux

2008-10-21 Thread Bulat Ziganshin
Hello Ketil,

Tuesday, October 21, 2008, 10:56:40 PM, you wrote:

 what's the simplest way to install ghc + gtk2hs on Ubuntu x86 system?

 Untested, but try:

   sudo apt-get install libghc6-gtk-dev 

thanks to everyone who answered. this one was shortest and it works. i
don't tested other answers but guess that they work too :)


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


[Haskell-cafe] cabal-install question

2008-10-21 Thread Ken98

Hello, I recently started using cabal-install to install packages. However,
ran into a problem today trying to install ftphs where the current HUnit
dependency required base (==4). I'm using ghc-6.8.2 on ubuntu. 

To get around this, I looked through previous versions of HUnit and found
that 1.2.0.0 was the last to have a successful build with ghc-6.8. So, I
downloaded the tar.gz and did a runhaskell Setup.hs ... This worked and I
was able to complete the ftphs install. 

So my question is, could I have used cabal install to specify the specific
version of HUnit without having to do the manual
download/configure/build/install? 

Thanks,
Ken
-- 
View this message in context: 
http://www.nabble.com/cabal-install-question-tp20098091p20098091.html
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] cabal-install question

2008-10-21 Thread Svein Ove Aas
On Tue, Oct 21, 2008 at 11:37 PM, Ken98 [EMAIL PROTECTED] wrote:

 Hello, I recently started using cabal-install to install packages. However,
 ran into a problem today trying to install ftphs where the current HUnit
 dependency required base (==4). I'm using ghc-6.8.2 on ubuntu.

Right, that's the 6.10 version of base.

 So my question is, could I have used cabal install to specify the specific
 version of HUnit without having to do the manual
 download/configure/build/install?

Yes, you should be able to say cabal install HUnit-1.2.0.0 or so.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Cabal warning

2008-10-21 Thread Henk-Jan van Tuyl


L.S.,

I keep getting the following warning for each cabal install command:
   Warning: Error parsing config file C:\Documents and
   Settings\[User]\Application Data\cabal\config: On line 1: GHC
   Warning: Using default configuration.

The first line of this file is:
compiler: GHC

What can I do about this?

--
Regards,
Henk-Jan van Tuyl


--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--

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


Re: [Haskell-cafe] Build without install, using cabal

2008-10-21 Thread Duncan Coutts
On Mon, 2008-10-20 at 17:04 -0200, Mauricio wrote:
 Hi,
 
 I would like to include a few source files
 as 'executable' sections in a .cabal package
 description. However, although I do want to
 use main=mainDefault features, I do not want
 those packages to be installed when I run
 'Setup.hs install'.
 
 Is it possible to do that? I believe there's
 no flag that indicates install step, since (I
 guess) flags are checked only at configure
 time.

Yes, just use this in the executable section:

buildable: False


Duncan

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


Re: [Haskell-cafe] Cabal warning

2008-10-21 Thread Duncan Coutts
On Wed, 2008-10-22 at 00:05 +0200, Henk-Jan van Tuyl wrote:
 L.S.,
 
 I keep getting the following warning for each cabal install command:
 Warning: Error parsing config file C:\Documents and
 Settings\[User]\Application Data\cabal\config: On line 1: GHC
 Warning: Using default configuration.
 
 The first line of this file is:
 compiler: GHC
 
 What can I do about this?

Can you save a copy of the file and attach it to a new ticket at:
http://hackage.haskell.org/trac/hackage/

I'll look into why it's not parsing the old format correctly.

Once you've done that, you can delete the file and let it re-create a
default one.

Duncan

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


Re: [Haskell-cafe] Spine-lazy multiqueue

2008-10-21 Thread Luke Palmer
On Tue, Oct 21, 2008 at 3:02 PM, Justin Bailey [EMAIL PROTECTED] wrote:
 On Tue, Oct 21, 2008 at 11:43 AM, Luke Palmer [EMAIL PROTECTED] wrote:
 Hi, I need a rather strange data structure, and I can't find any
 existing implementations or think of a way to implement it.  It's a
 multiqueue, basically a map of queues.  The trick is that it should
 be lazy in its spine and still support efficient access.  For example,
 the following should hold:


 This doesn't answer your question, but how is a Map of queues not
 spine-lazy? I'm mostly looking to understand that term.

Well, first, my question was highly malformed.  I actually just want a
spine lazy map of lists; queues were not what I wanted.

Data.Map is strict in its keys, meaning rougly that you cannot store
infinitely many keys in a map.  So:

  foldr (\x x - Map.insert x x) Map.empty [0..]  =  _|_

I.e. if you take this map that maps every natural to itself and try to
do anything with it, you will get an infinite loop (or stack overflow,
or whatever).

On the other hand, the map type [(k,v)] *is* spine lazy, because, for example:

  lookup 42 [ (x,x) | x - [0..] ]  = Just 42

It's just not very efficient.  I'm basically looking for a version of
the above which has a logarithmic lookup time.

The best I've come up with so far is a binary search tree where the
most recently inserted thing is at the root.  It's not balanced,
because balancing would make it strict (as far as I can tell).  So
it's only logarithmic time sometimes.

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


Re: [Haskell-cafe] Re: ghc error: requested module name differs from name found in interface file

2008-10-21 Thread Duncan Coutts
On Tue, 2008-10-21 at 09:41 -0500, Larry Evans wrote:
 Just that one little piece of information, that |cabal install| , by
 default, installs in ~/.cabal and then enables ghc to look there for
 packages, would have saved an awful lot of time :(

Where would you like that information to have been presented? Perhaps
something the first time you used the cabal command to say what
configuration it was using?

Duncan

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


[Haskell-cafe] Re: Template Haskell

2008-10-21 Thread Achim Schneider
Andrew Coppin [EMAIL PROTECTED] wrote:

 If I'm understanding this correctly, Template Haskell is a way to 
 auto-generate repetative Haskell source code.
 
 The thing that worries me is... if you need to write repetative
 Haskell source code, doesn't that mean that Haskell itself is broken
 in the first place?

If you've merely got repetitive code, use monads or even plain, simple
functions. If you've got something to generate code from, be it an .xml
or directly a direct algorithmic description of an algorithm, use
templates.

Imagine generating an HTML combinator library out of the HTML dtd or
generating specialised versions of an n-dimensional A*.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

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


Re: [Haskell-cafe] Template Haskell

2008-10-21 Thread Philippa Cowderoy
On Tue, 21 Oct 2008, Andrew Coppin wrote:

 If I'm understanding this correctly, Template Haskell is a way to
 auto-generate repetative Haskell source code.
 

Amongst other things, yes. It's also a way to perform repetitive 
transformations on code, for example.

 The thing that worries me is... if you need to write repetative Haskell source
 code, doesn't that mean that Haskell itself is broken in the first place?
 

For what're sometimes pretty picky values of broken that apply to almost 
any statically-typed language, yeah. Sometimes we don't know what 
non-broken would look like yet though.

-- 
[EMAIL PROTECTED]

I think you mean Philippa. I believe Phillipa is the one from an
alternate universe, who has a beard and programs in BASIC, using only
gotos for control flow. -- Anton van Straaten on Lambda the Ultimate
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Template Haskell

2008-10-21 Thread Ariel J. Birnbaum
 The thing that worries me is... if you need to write repetative Haskell
 source code, doesn't that mean that Haskell itself is broken in the
 first place?

I wouldn't go as far as calling it broken. Sure, writing boilerplate is a 
pain, but Haskell in this respect is far better than many (most?) other 
languages. On top of that, the language keeps evolving with new extensions 
that add new flexibility, TH being one of them.

This is the part when the Lisp hackers in the audience chuckle, as one of them 
raises a hand and asks What happens when you grow tired of writing TH 
boilerplate? Wait for another extension? And what after that?.

Note to self: give Liskell a try before the end of the year.

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


Re: [Haskell-cafe] Template Haskell

2008-10-21 Thread Philippa Cowderoy
On Wed, 22 Oct 2008, Ariel J. Birnbaum wrote:

 This is the part when the Lisp hackers in the audience chuckle, as one of 
 them 
 raises a hand and asks What happens when you grow tired of writing TH 
 boilerplate? Wait for another extension? And what after that?.
 

To be fair, the TH boilerplate isn't an awful lot more than you'd get 
stuck with in lisp anyway. You just use TH to call more TH in that case.

-- 
[EMAIL PROTECTED]

Performance anxiety leads to premature optimisation
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ghc error: requested module name differs from name found in interface file

2008-10-21 Thread Larry Evans

On 10/21/08 17:55, Duncan Coutts wrote:

On Tue, 2008-10-21 at 09:41 -0500, Larry Evans wrote:

Just that one little piece of information, that |cabal install| , by
default, installs in ~/.cabal and then enables ghc to look there for
packages, would have saved an awful lot of time :(


Where would you like that information to have been presented? Perhaps
something the first time you used the cabal command to say what
configuration it was using?

Duncan


I'd suggest putting this information after the brief description of the
install option here:

  http://hackage.haskell.org/trac/hackage/wiki/CabalInstall

For example:

  Commands:
  install  Installs a list of packages.
The 'visibility' of the install depends on whether
--user or --global FLAG is used.  With --user,
the package is only visible to the user invoking
the cabal command.  With --global, the package is
visible to all users; however, this requires root
authority.
  list List available packages on the server (cached).
  ...

I'm at fault for not reading:

  For more information about a command, try 'cabal COMMAND --help'.

lower down on that page.  I do remember actually doing

  cabal install --help

but I can't remember if that was after or before Bertrand's post.
However, even that command's description of the meaning of
--user and --global is obscured by so many other options, that
it's easy to miss.  Also their descriptions:

--user Enable doing a per-user installation
--global   Disable doing a per-user installation

doesn't explain what 'per-user installation' means.  If it just said:

  A per-user installation means the installed package is only seen
  by the haskell compiler if the compiler is invoked by the same user
  which issued the 'cabal install' command.

That would have clearly indicated to me that the root doing
'cabal install' would not make the installed package available
to any other user. (I probably should have figured this out
by noting the location was /root/.cabal/...; however, that
just didn't happen.)

HTH and thanks for your interest.

-regards,
Larry

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


Re: [Haskell-cafe] Spine-lazy multiqueue

2008-10-21 Thread Sterling Clover
On 10/21/08, Luke Palmer [EMAIL PROTECTED] wrote:
 Well, first, my question was highly malformed.  I actually just want a
  spine lazy map of lists; queues were not what I wanted.
  [...]
  The best I've come up with so far is a binary search tree where the
  most recently inserted thing is at the root.  It's not balanced,
  because balancing would make it strict (as far as I can tell).  So
  it's only logarithmic time sometimes.

Surely a trie would do the job? With each node a map? One could
probably even produce a Patricia trie at some constant cost to keep
things on the order of number of elements (ish)rather than on the
order of length of elements. Either way its not exactly going to be
log (n) but depending on what you're storing it might be as efficient
if not more so, and indeed would let you be lazy in the amount of each
key consumed (assuming keys are, e.g., lists and not ints) as well as
in the spine.

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


Re: [Haskell-cafe] code generation

2008-10-21 Thread Anatoly Yakovenko
you can also write an interpreter in haskell that will typecheck using GADT's

http://www.informatik.uni-bonn.de/~ralf/publications/With.pdf

http://www.haskell.org/pipermail/haskell/2005-May/015815.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Spine-lazy multiqueue

2008-10-21 Thread Timothy Goddard
On Wed, 22 Oct 2008 11:54:50 Luke Palmer wrote:
 On Tue, Oct 21, 2008 at 3:02 PM, Justin Bailey [EMAIL PROTECTED] wrote:
  On Tue, Oct 21, 2008 at 11:43 AM, Luke Palmer [EMAIL PROTECTED] wrote:
  Hi, I need a rather strange data structure, and I can't find any
  existing implementations or think of a way to implement it.  It's a
  multiqueue, basically a map of queues.  The trick is that it should
  be lazy in its spine and still support efficient access.  For example,
  the following should hold:
 
  This doesn't answer your question, but how is a Map of queues not
  spine-lazy? I'm mostly looking to understand that term.

 Well, first, my question was highly malformed.  I actually just want a
 spine lazy map of lists; queues were not what I wanted.

 Data.Map is strict in its keys, meaning rougly that you cannot store
 infinitely many keys in a map.  So:

   foldr (\x x - Map.insert x x) Map.empty [0..]  =  _|_

 I.e. if you take this map that maps every natural to itself and try to
 do anything with it, you will get an infinite loop (or stack overflow,
 or whatever).

 On the other hand, the map type [(k,v)] *is* spine lazy, because, for
 example:

   lookup 42 [ (x,x) | x - [0..] ]  = Just 42

 It's just not very efficient.  I'm basically looking for a version of
 the above which has a logarithmic lookup time.

 The best I've come up with so far is a binary search tree where the
 most recently inserted thing is at the root.  It's not balanced,
 because balancing would make it strict (as far as I can tell).  So
 it's only logarithmic time sometimes.

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

You might possibly be able to get a logarithmic lookup time for keys known to 
be present while preserving some laziness (don't ask me how) but to say a key 
does not exist in the map you would have to somehow check them all, which 
with an infinite list of keys will never complete.

You're unlikely to get a free lunch with infinite maps - infinite items means 
infinite depth to any tree structure and there are few other nice 
alternatives.

You could simply add your own laziness - have a special map which consumes a 
list of (key, value) pairs and where reading the map also returns another map 
evaluated enough to answer the immediate query. Reading an already discovered 
key will take logarithmic time while reading an undiscovered key will take as 
long as it takes to find it in the list (for a nonexistent key, until memory 
runs out).

You could also work carefully with mutable references inside the map to make 
it appear pure from the outside. It could still present a referentially 
transparent interface since it is only evaluating itself further, not 
changing what it actually contains. You would have to make sure this worked 
properly though.

With that map you could perform updates as normal. Reading a value from the 
input list that already exists in the map would just do nothing.

I was interested enough to give this a try. Source is attached. It's 
incomplete - if you finish it please send me the result. Otherwise, use as 
you like.

Cheers,

Tim
module InfiniteMap
  (
InfiniteMap,
fromList,
(!)
  )
  where

import System.IO.Unsafe
import Data.IORef
import qualified Data.Map as M

data InfiniteMap k v = InfiniteMap {imRef :: IORef ((M.Map k v), [(k, v)])}

fromList :: Ord k = [(k, v)] - InfiniteMap k v
fromList l = InfiniteMap (unsafePerformIO $ newIORef (M.empty, l))

fillMapUntil :: (Ord k, Eq k) = k - (M.Map k v, [(k, v)]) - (M.Map k v, [(k, 
v)])
fillMapUntil tk (m, []) = (m, [])
fillMapUntil tk (m, ((k, v):xs))
  | tk == k = (filledMap, xs)
  | otherwise = fillMapUntil tk (filledMap, xs)
  where
filledMap = M.insertWith' (\a _ - a) k v m

(!) :: Ord k = InfiniteMap k v - k - v
m ! k = if k `M.member` cmap then (M.!) cmap k else (if k `M.member` newMap 
then (M.!) newMap k else error Key not in map)
  where
cmap = fst $ unsafePerformIO $ readIORef $ imRef m
newMap = unsafePerformIO $ do
  (nm, nl) - atomicModifyIORef (imRef m) (\a - let res = fillMapUntil k a 
in (res, res))
  return nm

insert :: Ord k = k - v - InfiniteMap k v - InfiniteMap k v
insert k v m = InfiniteMap $ unsafePerformIO $ newIORef (M.insert k v cmap, 
clist)
  where
(cmap, clist) = unsafePerformIO $ readIORef $ imRef m

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


[Haskell-cafe] Help converting Perl to Haskell

2008-10-21 Thread Jason Dagit
Hello,

I'm not very perl literate, but I want to convert a perl script to
Haskell.  This bit of perl is part of darcs' test suite.  I was hoping
to make it more portable by writing it in Haskell.  By more portable
I mean, works in windows without cygwin/mingw/msys and avoids the need
for perl also.  Depending on a Haskell compiler seems reasonable since
darcs is written in Haskell :)

Correct me if I'm wrong, but if I want to make this work on windows I
can't use System.Posix, right?  If so, what is the portable way to set
environment variables?  I see[1] that getEnv exists in
System.Environment, but setEnv is in System.Posix.Env.  I looked in
System.Win32 and I didn't see anything that looked like it would
manipulate environment variables.  Will I have to use
System.Process.runProcess on Win32?  I'd like this to work on ghc 6.6
and System.Process looks new?

Another thing I noticed is that System.Directory doesn't give me a way
to exactly emulate this bit of perl:
mkdir 'test_output', 0750;

If I use System.Directory.setPermissions, then I think the closest I
can approximate those permissions is:
setPermissions test_output (Permissions {readable = True, writable =
True, executable = True, searchable = True})

Which just makes sure it has the 7 for user, but doesn't seem to
change the other permissions.  Maybe that won't matter in practice,
but I wanted to make it as close as possible to minimize unforeseen
problems.  I guess I could write a function that uses setPermissions
on win32 and uses the appropriate thing from System.Posix when not on
windows.

Below is the full perl script if you want to see what I'm starting
from.  I think most of it should be easy to replace.

\begin{perl}
#!/usr/bin/perl -w

# Run each of the shell tests, capturing the output, and reporting passed
# or failed.

use Cwd;
use File::Find;

# Place to put test output to avoid cluttering test/
mkdir 'test_output', 0750;

# Override the users default .darcs settings
$ENV{HOME} = cwd();
mkdir '.darcs';
system 'echo ALL --ignore-times  .darcs/defaults';
# Used for finding darcs, but may not be defined by the shell
$ENV{PWD} = cwd();

# Put the right darcs first in PATH
my $darcspath=$ENV{HOME}/..;
if ($ENV{DARCS}) {
  # User has asked for a particular darcs...
  my $actualdarcs=`which $ENV{DARCS}`;
  my $darcspath=`dirname $actualdarcs`;
}
$ENV{PATH} = $darcspath:$ENV{PATH};

# Some environment variables can act as defaults that we don't want
$ENV{EMAIL} = $ENV{DARCS_EMAIL} = 'tester';

# These two environment variables will turn off darcs' Christmas mode.
# It will make the tests run a tad faster, and make darcs' output
# independent of the testing systems locale and environment.
$ENV{DARCS_DONT_COLOR} = 1;
$ENV{DARCS_DONT_ESCAPE_ANYTHING} = 1;

my $OK = 1;
my @Failures;
my @Passes;

`which bash`;
if( $? != 0 ) {
die You need bash to run the shell tests!
}

for my $test (@ARGV) {
my $test_out = test_output/$test.out;

printf Running %-40s, $test ...;

my $output = `bash $test 21`;

if( $? == 0 ) {
push @Passes, $test;
print  passed.\n;
}
else {
$OK = 0;
push @Failures, $test;

print  FAILED!\n;
print Output from failed $test:\n$output;
}
# give ourselves write permissions to every file in a tmp dir
# (in case a script sets permissions and fails to clean up
# after itself)
my @tmpdirs = glob(tmp* temp*);
if (@tmpdirs  0) {
  find (sub { chmod 0755, $_; }, @tmpdirs);
}
}

my $CWD = cwd();
if ($CWD =~ /bugs/  $#Passes = 0) {
  print Some tests passed:\n;
  print \t$_\n for @Passes;
}
if ($OK) {
print All tests successful!\n;
}
else {
print TESTS FAILED!\n;
print \t$_\n for @Failures;
}

# Exit with non-zero if anything failed.
exit !$OK;
\end{perl}

Thanks!
Jason

[1] http://www.haskell.org/ghc/docs/latest/html/libraries/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Help converting Perl to Haskell

2008-10-21 Thread Duncan Coutts
On Tue, 2008-10-21 at 20:33 -0700, Jason Dagit wrote:

 Correct me if I'm wrong, but if I want to make this work on windows I
 can't use System.Posix, right?  If so, what is the portable way to set
 environment variables?  I see[1] that getEnv exists in
 System.Environment, but setEnv is in System.Posix.Env.  I looked in
 System.Win32 and I didn't see anything that looked like it would
 manipulate environment variables.  Will I have to use
 System.Process.runProcess on Win32?  I'd like this to work on ghc 6.6
 and System.Process looks new?

Right. Typically you do not need to change the env vars for your own
process, just to pass new ones to new processes and
System.Process.runProcess lets you specify a new set of environment
vars.

As you can check, System.Process.runProcess has been around since ghc
6.6 (and before):

http://www.haskell.org/ghc/docs/6.6/html/libraries/base/System-Process.html#v%3ArunProcess

Duncan

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