Re: [Haskell-cafe] Re: Images and GUIs in Haskell

2008-06-02 Thread Yann Golanski
Quoth Achim Schneider on Sun, Jun 01, 2008 at 04:09:10 +0200
 I would go for GL(U(T)), as it's as good for 2d primitives as SDL will
 ever be, has excellent cross-platform support and allows you to go 3d
 if you want to. There's also some very decent event handling.

You can use R as well. http://www.r-project.org/

-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgpUxe2kMb6IX.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCi panic

2008-06-02 Thread Jules Bean

Andrew Coppin wrote:

I don't suppose this will surprise anybody greatly, but...

Apparently if you write a Haskell module that is 400 KB in size and 
defines a single CAF consisting of a 45,000-element [String], GHCi 
panics when attempting to load it interpretted, and hits a stack 
overflow attempting to load it compiled.


qv http://hackage.haskell.org/trac/ghc/ticket/2002
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: hmatrix

2008-06-02 Thread Alberto Ruiz

Anatoly Yakovenko wrote:

do you have any plans to provide an interface for inplace updates?


Yes, I will try to write a simple version of Data.Array.ST...


On Sun, Jun 1, 2008 at 3:20 AM, Alberto Ruiz [EMAIL PROTECTED] wrote:

Anatoly Yakovenko wrote:

What is the most efficient way to update a position in a matrix or a
vector?  I came up with this:

updateVector :: Vector Double - Int - Double - Vector Double
updateVector vec pos val = vec `add` v2
  where
 v2 = fromList $ (replicate (pos) 0.0) ++ ((val - (vec @
pos)):(replicate ((dim vec)- pos - 1) 0.0))

but this seems pretty inefficient to me.

thanks,
Anatoly


It is probably more efficient to use subVector and join (implemented by
copyArray):

updateVector' v pos val
   | pos == 0= join [b,c]
   | pos == dim v -1 = join [a,b]
   | otherwise   = join [a,b,c]
   where a = subVector 0 pos v
 b = fromList [val]
 c = subVector (pos+1) (dim v -pos-1) v


updateVector' (fromList [1,2,3,4,5]) 2 57

5 | [1.0,2.0,57.0,4.0,5.0]

(The three cases are required because empty vectors are not currently
allowed.)

Something similar can be done for matrices using flatten and reshape.

Although vectors and matrices in this library are immutable and intended to
be manipulated as a whole by higher level functions, this kind of update
functions may often be useful. I will include them soon.

Alberto




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


Re: [Haskell-cafe] [ANNOUNCE] git-darcs-import 0.1

2008-06-02 Thread Thomas Schilling


On 1 jun 2008, at 20.44, Bertram Felgenhauer wrote:


Hi,

I'm pleased to announce yet another tool for importing darcs  
repositories

to git. Unlike darcs2git [1] and darcs-to-git [2], it's written in
Haskell, on top of the darcs2 source code. The result is a much faster
program - it can convert the complete ghc 6.9 branch (without  
libraries)
in less than 15 minutes on my slightly dated machine (Athlon XP 2500 
+),

which is quite fast [3]. Incremental updates work, too.


Nice!  Do you happen to also have a darcs (or Git) repository somewhere?

/ Thomas
--
Monkey killing monkey killing monkey over pieces of the ground.
Silly monkeys give them thumbs they forge a blade
And where there's one they're bound to divide it
Right in two



PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghc 6.8.2 issue

2008-06-02 Thread Duncan Coutts

On Mon, 2008-06-02 at 00:07 -0500, Galchin, Vasili wrote:
 Hello,
 
   I have been developing new code for the unix package. I have
 run into what I think are ghc 6.8.2 anomalies but couldn't see a
 pattern. Possibly now I do. I have been using the 32-bit x86 ghc
 binary that I downloaded from http://www.haskell.org and running on
 Ubuntu Linux. I am pretty I can repeat now. Everything is ok until I
 do sudo runhaskell Setup.hs install which installs a new unix
 package that I just built. Of course the intall installs
 into /usr/local/lib/unix-2.3.0.0/ghc-6.8.2. The install seems to
 destroy some ghc compiler state under /usr/local ...

That sounds right. You're replacing the unix-2.3.0.0 library that comes
with ghc-6.8.2 with your own version. It is highly unlikely to be ABI
compatible with the one you are replacing and so all the other packages
that already depends on the existing unix-2.3.0.0 library end up broken.
You'd expect this kind of breakage to be exposed as link errors and
segfaults.

I suggest you do not replace any of the libraries that come with ghc. To
be more precise, it is perfectly ok to *add new versions* but it is not
ok to *replace existing versions* without rebuilding all the other libs
that depend on it.

Make sense?

So if you really want to make changes to the unix lib, make sure you
change the version number too. I also suggest not installing the
packages as root, just install them locally. That way you can guarantee
you never mess up your ghc install. You would be able to revert to a
clean ghc install just by removing your
~/.ghc/$arch/ghc-6.8.2/package.conf file which will unregister *all*
locally registered packages. To unregister individual packages use
ghc-pkg --user unregister $pkgname

Duncan

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


Re: [Haskell-cafe] [ANNOUNCE] git-darcs-import 0.1

2008-06-02 Thread Bertram Felgenhauer
Thomas Schilling wrote:

 On 1 jun 2008, at 20.44, Bertram Felgenhauer wrote:
[git-darcs-import]

 Nice!  Do you happen to also have a darcs (or Git) repository somewhere?

I've uploaded my (git) repo to repo.or.cz, see
http://repo.or.cz/w/git-darcs-import.git

Patches are welcome.

enjoy,

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


[Haskell-cafe] hs-plugins compile error

2008-06-02 Thread Edsko de Vries
Hi,

I'm getting the compilation error that is actually logged on Hackage:

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

Below is a small diff file that resolves these problems; I don't know
what the proper protocol is for submitting these diffs but it may be
useful to someone.

- E 

diff -ur plugins-1.2-orig/src/System/Plugins/Env.hs 
plugins-1.2/src/System/Plugins/Env.hs
--- plugins-1.2-orig/src/System/Plugins/Env.hs  2008-06-02 14:57:59.0 
+0100
+++ plugins-1.2/src/System/Plugins/Env.hs   2008-06-02 15:00:25.0 
+0100
@@ -73,7 +73,7 @@
 
 import Control.Concurrent.MVar  ( MVar(), newMVar, withMVar )
 
-import Distribution.Package
+import Distribution.Package hiding (packageName)
 import Text.ParserCombinators.ReadP
 
 import qualified Data.Map as M
diff -ur plugins-1.2-orig/src/System/Plugins/PackageAPI.hs 
plugins-1.2/src/System/Plugins/PackageAPI.hs
--- plugins-1.2-orig/src/System/Plugins/PackageAPI.hs   2008-06-02 
14:57:59.0 +0100
+++ plugins-1.2/src/System/Plugins/PackageAPI.hs2008-06-02 
14:59:49.0 +0100
@@ -40,7 +40,7 @@
 
 #if CABAL == 1 || __GLASGOW_HASKELL__ = 604
 import Distribution.InstalledPackageInfo
-import Distribution.Package
+import Distribution.Package hiding (depends, packageName)
 #else
 import System.Plugins.Package
 #endif
diff -ur plugins-1.2-orig/src/System/Plugins/ParsePkgConfCabal.hs 
plugins-1.2/src/System/Plugins/ParsePkgConfCabal.hs
--- plugins-1.2-orig/src/System/Plugins/ParsePkgConfCabal.hs2008-06-02 
14:57:59.0 +0100
+++ plugins-1.2/src/System/Plugins/ParsePkgConfCabal.hs 2008-06-02 
14:58:56.0 +0100
@@ -6,7 +6,7 @@
   ) where
 
 import Distribution.InstalledPackageInfo
-import Distribution.Package
+import Distribution.Package hiding (depends)
 import Distribution.Version
 
 import Data.Char ( isSpace, isAlpha, isAlphaNum, isUpper, isDigit )

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


[Haskell-cafe] Mutually Recursive Modules

2008-06-02 Thread Richard Giraud

Hello

I'm using GHC 6.8.2 with mutally recursive modules.  I'm familiar with 
how to do simple cases in GHC ({-# SOURCE #-} and .hs-boot files) but I 
can't figure out how to get it to work for a particular set of modules.


Is it known (i.e., proven) that GHC 6.8.2 can compile any set of 
mutually recursive modules without refactoring?  Are there known 
limitations?


Thanks,

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


Re: [Haskell-cafe] Mutually Recursive Modules

2008-06-02 Thread Isaac Dupree

Richard Giraud wrote:

Hello

I'm using GHC 6.8.2 with mutally recursive modules.  I'm familiar with 
how to do simple cases in GHC ({-# SOURCE #-} and .hs-boot files) but I 
can't figure out how to get it to work for a particular set of modules.


Is it known (i.e., proven) that GHC 6.8.2 can compile any set of 
mutually recursive modules without refactoring?  Are there known 
limitations?


With the old (6.2 and before) .hi-boot scheme where there was no 
abstraction in boot-files, it could probably do anything that it could 
do.  But I'm not convinced with .hs-boot... it can resolve one level of 
cycle, and I don't know how to *prove* that it *can't* do any given 
thing, but I strongly suspect there are things it can't do.  Luckily, it 
is very often the case that your code will be better off anyway if 
refactored to have less module recursion. (though not always.)


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


Re: [Haskell-cafe] Re: Damnit, we need a CPAN.

2008-06-02 Thread Wolfgang Jeltsch
Am Freitag, 30. Mai 2008 22:09 schrieb Achim Schneider:
 […]

 I'm generally very interested in declarative GUI programming, but not
 nearly enough acquainted with the whole topic to judge one project's
 approach over the other. I just followed standard scientific evaluation
 technique to select the projects to consider: The ones with the most and
 most recent activity win.

 So far, my impression is that documentation is severely lacking, but
 then I'm too busy watching Babylon 5 right now and did not get more
 than half an hour or so looking at grapefruit.

Okay, I think we’ll improve API documentation and then make a release, despite 
Grapefruit not being production quality yet.  I hope, you’ll find it 
useful. :-) 

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


[Haskell-cafe] What is the maturity of Haskell Web Frameworks

2008-06-02 Thread Aditya Siram

I am building a web-app that, in broad strokes, allows a leader to assign tasks 
to team members and allows team members to accept/reject/pick tasks that they 
want to do. 

I really like Haskell and I would like to use it to implement the solution. Are 
frameworks like Happs ready? Not so much in terms of documentation, but in 
functionality and stability. 

-Deech
_
Give to a good cause with every e-mail. Join the i’m Initiative from Microsoft.
http://im.live.com/Messenger/IM/Join/Default.aspx?souce=EML_WL_ 
GoodCause___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Default definitions for associated type synonyms

2008-06-02 Thread Stefan Holdermans

Isaac,

Does anyone know if it is possible to specify a default definition  
for an

associated type synonym?



According to http://hackage.haskell.org/trac/ghc/wiki/TypeFunctionsStatus 
 defaults for associated types is still a TODO.


Cheers,

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


Re: [Haskell-cafe] Default definitions for associated type synonyms

2008-06-02 Thread Isaac Dupree

Dreixel wrote:

Hello,

Does anyone know if it is possible to specify a default definition for an
associated type synonym? When I tried:

class A a where

  type B a = a



GHC (version 6.9.20080309) told me: Type declaration in a class must be a
kind signature or synonym default. However, when I look at the parser I see
no way to specify such synonym default. Is this possible?


I'm curious... so, cc'ing glasgow-haskell-users mailinglist because the 
question is more likely to be noticed by relevant people there.



Thanks,
Zé Pedro

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


Re: [Haskell-cafe] What is the maturity of Haskell Web Frameworks

2008-06-02 Thread Marc Weber
On Mon, Jun 02, 2008 at 09:37:11AM -0500, Aditya Siram wrote:
 
 I am building a web-app that, in broad strokes, allows a leader to assign 
 tasks to team members and allows team members to accept/reject/pick tasks 
 that they want to do. 
 
 I really like Haskell and I would like to use it to implement the solution. 
 Are frameworks like Happs ready? Not so much in terms of documentation, but 
 in functionality and stability. 
Me too, but in this case if it's only about assigning tasks you should
consider using existing solutions such as flysrpay or mantis 
http://www.mantisbt.org/
Maybe they fit your needs ?

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


[Haskell-cafe] Re: cabal install fail for happs-hsp-template

2008-06-02 Thread Thomas Hartman
I just noticed this is also reported as a 6.8 build failure on hackage itself.

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/happs-hsp-template

2008/6/2 Thomas Hartman [EMAIL PROTECTED]:
 Can cabal install be made to work for this package?
 *
 [EMAIL PROTECTED]:~sudo cabal install happs-hsp-template
 [sudo] password for thartman:
 cabal: internal error: could not construct a valid install plan.
 The proposed (invalid) plan contained the following problems:
 Package Cabal is required by several packages, but they require
 inconsistent versions:
  package ghc-6.8.2 requires Cabal-1.2.3.0
  package plugins-1.2 requires Cabal-1.5.2


 [EMAIL PROTECTED]:~cabal --version
 cabal-install version 0.4.7
 using version 1.3.11 of the Cabal library
 [EMAIL PROTECTED]:~ghc --version
 The Glorious Glasgow Haskell Compilation System, version 6.8.2
 [EMAIL PROTECTED]:~ghc-pkg list | grep -i ghc
 /usr/local/lib/ghc-6.8.2/package.conf:
(ghc-6.8.2), haskell-src-1.0.1.1, haskell98-1.0.1.0, hpc-0.5.0.0,

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


[Haskell-cafe] Re: hmatrix

2008-06-02 Thread Anatoly Yakovenko
 do you have any plans to provide an interface for inplace updates?

 Yes, I will try to write a simple version of Data.Array.ST...


I can try to help you, although I still dont quite grok monads.
Wouldn't it be more efficient to use StorableArray, so you can cast
from and to C?  I am not sure how vectors and matrixes are represented
in C, but I imagine it should be possible to manipulate them without
resorting to copying between haskell and C.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] cabal install fail for happs-hsp-template

2008-06-02 Thread Thomas Hartman
Can cabal install be made to work for this package?
*
[EMAIL PROTECTED]:~sudo cabal install happs-hsp-template
[sudo] password for thartman:
cabal: internal error: could not construct a valid install plan.
The proposed (invalid) plan contained the following problems:
Package Cabal is required by several packages, but they require
inconsistent versions:
  package ghc-6.8.2 requires Cabal-1.2.3.0
  package plugins-1.2 requires Cabal-1.5.2


[EMAIL PROTECTED]:~cabal --version
cabal-install version 0.4.7
using version 1.3.11 of the Cabal library
[EMAIL PROTECTED]:~ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.2
[EMAIL PROTECTED]:~ghc-pkg list | grep -i ghc
/usr/local/lib/ghc-6.8.2/package.conf:
(ghc-6.8.2), haskell-src-1.0.1.1, haskell98-1.0.1.0, hpc-0.5.0.0,
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Damnit, we need a CPAN.

2008-06-02 Thread Thomas Schilling


On 29 maj 2008, at 18.13, Don Stewart wrote:


Hackage and Cabal are nice, but a command line tool for automatically
searching Hackage and installing Hackage packages (like the cpan
program, or easy_install) would be nice.  Unless I haven't done my
homework and this tool exists...



This tool exists. It is called 'cabal-install'. To try out one of
today's new packages:

$ cabal update
$ cabal install category-extras




Another nice feature:  Say you want to hack on the darcs version of a  
project, but you need to install the dependencies.  If the project is  
Cabalised you can build and install the darcs version as well as all  
dependencies by calling 'cabal install' with no arguments inside the  
project directory.


  $ darcs get project
  $ cd project
  $ cabal install

/ Thomas
--
Push the envelope.  Watch it bend.





PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What is the maturity of Haskell Web Frameworks

2008-06-02 Thread Don Stewart
aditya_siram:
 
 I am building a web-app that, in broad strokes, allows a leader to
 assign tasks to team members and allows team members to
 accept/reject/pick tasks that they want to do. 
 
 I really like Haskell and I would like to use it to implement the
 solution. Are frameworks like Happs ready? Not so much in terms of
 documentation, but in functionality and stability. 

HAppS is nice (see hpaste.org for example, which is nice and simple, and
has been running for over a year).

Another nice option in Haskell is using something like HStringTemplate
or the xhtml combinators  with fastcgi hooked into GHC's concurrency
mechanisms.

You can find *many* more things here,

http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Network
http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Web
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hs-plugins compile error

2008-06-02 Thread Don Stewart
Thanks, 

if possible, could you construct this as a patch against the darcs
branch, which lives here:

http://code.haskell.org/~dons/code/hs-plugins

Cheers,
  Don

devriese:
 Hi,
 
 I'm getting the compilation error that is actually logged on Hackage:
 
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plugins
 
 Below is a small diff file that resolves these problems; I don't know
 what the proper protocol is for submitting these diffs but it may be
 useful to someone.
 
 - E 
 
 diff -ur plugins-1.2-orig/src/System/Plugins/Env.hs 
 plugins-1.2/src/System/Plugins/Env.hs
 --- plugins-1.2-orig/src/System/Plugins/Env.hs2008-06-02 
 14:57:59.0 +0100
 +++ plugins-1.2/src/System/Plugins/Env.hs 2008-06-02 15:00:25.0 
 +0100
 @@ -73,7 +73,7 @@
  
  import Control.Concurrent.MVar  ( MVar(), newMVar, withMVar )
  
 -import Distribution.Package
 +import Distribution.Package hiding (packageName)
  import Text.ParserCombinators.ReadP
  
  import qualified Data.Map as M
 diff -ur plugins-1.2-orig/src/System/Plugins/PackageAPI.hs 
 plugins-1.2/src/System/Plugins/PackageAPI.hs
 --- plugins-1.2-orig/src/System/Plugins/PackageAPI.hs 2008-06-02 
 14:57:59.0 +0100
 +++ plugins-1.2/src/System/Plugins/PackageAPI.hs  2008-06-02 
 14:59:49.0 +0100
 @@ -40,7 +40,7 @@
  
  #if CABAL == 1 || __GLASGOW_HASKELL__ = 604
  import Distribution.InstalledPackageInfo
 -import Distribution.Package
 +import Distribution.Package hiding (depends, packageName)
  #else
  import System.Plugins.Package
  #endif
 diff -ur plugins-1.2-orig/src/System/Plugins/ParsePkgConfCabal.hs 
 plugins-1.2/src/System/Plugins/ParsePkgConfCabal.hs
 --- plugins-1.2-orig/src/System/Plugins/ParsePkgConfCabal.hs  2008-06-02 
 14:57:59.0 +0100
 +++ plugins-1.2/src/System/Plugins/ParsePkgConfCabal.hs   2008-06-02 
 14:58:56.0 +0100
 @@ -6,7 +6,7 @@
) where
  
  import Distribution.InstalledPackageInfo
 -import Distribution.Package
 +import Distribution.Package hiding (depends)
  import Distribution.Version
  
  import Data.Char ( isSpace, isAlpha, isAlphaNum, isUpper, 
 isDigit )
 
 ___
 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: hmatrix

2008-06-02 Thread Bulat Ziganshin
Hello Anatoly,

 Yes, I will try to write a simple version of Data.Array.ST...
 Wouldn't it be more efficient to use StorableArray, so you can cast

there is some difference between them - MutableByteArray# (used for
STUArray) is movable Haskell object which is subject to GC while
StorableArray has a fixed address and allocated through C malloc().
this makes MBA more appropriate for small arrays while SA should be
used for large ones because GC makes memory usage of program 3 times
larger


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


[Haskell-cafe] Re: modelling C in Haskell ..

2008-06-02 Thread Ben Franksen
Galchin, Vasili wrote:
 my knowledge of point-free is from category theory. in what sense is
 Haskell point-free handle namespace pollution?

In the sense that you can write e.g.

  f = g . h

instead of

  f x = g (h x)

thereby avoiding the need to give a name the argument to f.

Cheers
Ben

BTW,
A: No.
Q: Should I include quotations after my reply?

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


Re: [Haskell-cafe] What is the maturity of Haskell Web Frameworks

2008-06-02 Thread Keith Fahlgren

On 6/2/08 10:21 AM, Don Stewart wrote:

aditya_siram:

I am building a web-app that, in broad strokes, allows a leader to
assign tasks to team members and allows team members to
accept/reject/pick tasks that they want to do. 


I really like Haskell and I would like to use it to implement the
solution. Are frameworks like Happs ready? Not so much in terms of
documentation, but in functionality and stability. 


HAppS is nice (see hpaste.org for example, which is nice and simple, and
has been running for over a year).

Another nice option in Haskell is using something like HStringTemplate
or the xhtml combinators  with fastcgi hooked into GHC's concurrency
mechanisms.


If you're interested in the background of rolling your own web stuff, I like 
Paul Brown's description of building perpubplat here: http://mult.ifario.us/t/blog



HTH,
Keith

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


[Haskell-cafe] Re: modelling C in Haskell ..

2008-06-02 Thread Ben Franksen
Galchin, Vasili wrote:

 typedef struct blah
 {
int val1;
 
union {
 
int  val2;
 
struct {
 
  int val3;
 
  int val4;
}
}
 }C_type;
 
 question: in Haskell, can I embed definition of the union inside of the
 C typedef, i.e. recursion definition? Or must I have a separate definition
 for the union which I instantiate inside the Haskell typedef, i.e.
 Haskell data?

No. Each definition of a data type must occur at the top-level. Also,
Haskell has only a very weak record system, a deficit that is generally
agreed to be one of Haskell's greatest weaknesses.

Like jcc, I'd also be interested what concrete problem prompted your
question. While I have often found it annoying that in Haskell e.g. record
labels are global in scope, I have never encountered a situation where I
wanted to have lexically nested data type declarations.

Cheers
Ben

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


Re: [Haskell-cafe] hs-plugins compile error

2008-06-02 Thread Edsko de Vries
Hi Don,

Is this the kind of thing you mean (I'm not really a darcs user; this is
the patch created by darcs record):

[Hide some names to remove ambiguity errors
Edsko de Vries [EMAIL PROTECTED]**20080602202001] {
hunk ./src/System/Plugins/Env.hs 76
-import Distribution.Package
+import Distribution.Package hiding (packageName)
hunk ./src/System/Plugins/PackageAPI.hs 43
-import Distribution.Package
+import Distribution.Package hiding (depends, packageName)
hunk ./src/System/Plugins/ParsePkgConfCabal.hs 9
-import Distribution.Package
+import Distribution.Package hiding (depends)
}

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


Re: [Haskell-cafe] Re: [ANN] bloomfilter 1.0 - Fast immutable and mutable Bloom filters

2008-06-02 Thread Edward Kmett
On Sat, May 31, 2008 at 6:22 PM, Jim Snow [EMAIL PROTECTED] wrote:
 In practice, one might use something like 32 hash tables.  This yields a
 false positive rate of 1/(2^32).  Their most obvious application is to store
 the dictionary for a spell checker in a space-efficient way, though I have a
 friend who wrote a paper on using them for router caches.

One minor technicality is that you don't actually use k separate hash
tables. You use k separate hash functions, and hash using different
functions into the same physical table with a goal of having
approximately half of
the bits in the table set when all of your data is hashed.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Vancouver Haskell users meeting

2008-06-02 Thread Jon Strait




Anyone else here from Vancouver (Canada)? I thought it would be great
to have a little informal get-together at a local cafe and share how
we're currently using Haskell, or really anything (problems,
comparisons, useful software tools, etc.) in relation to Haskell. 

I'm scheduling a meeting for this Thursday, June 5th. for 7PM at Waazubee Cafe.
(At Commercial Dr. and 1st Ave.) 

They have wireless internet access. I'll get a table near the back,
bring my laptop, and will have a copy of Hudak's SOE book (the front
cover is impossible to miss) out on the table. 

If anyone wants to meet, but this Thursday is not a good day for you,
let me know what days are better and we'll move the meeting. If anyone
is sure that they will come this Thursday, you might let me know, so I
can have an idea about the resistance in changing the day, if needed.

Thanks,

Jon



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


[Haskell-cafe] Implementing ParseChart with Data.Map

2008-06-02 Thread Krasimir Angelov
Hi,

I have to write ParseChart implementation with Data.Map/Set. The chart
is type like this:

type Chart k v = Map k (Set v)

now I need operation like:

insert :: k - v - Chart k v - Maybe (Chart k v)

where the result is (Just _) if the (k,v) is actually added to the
chart or Nothing if it was already there and nothing have to be done.
The straight forward implementation is:

case Map.lookup k chart of
  Nothing - Just (Map.insert k (Set.singleton v) chart)
  Just set | Set.member v set - Nothing
   | otherwise- Just (Map.insert k
(Set.insert v set) chart)

The problem with this is that both the Map and the Set are traversed
twice. The first time from lookup/member and the second time from
insert. Does someone have an idea how to do this with the current
libraries?

There are the Map.updateLookupWithKey and the Map.alter functions:

updateLookupWithKey :: Ord k = (k - a - Maybe a) - k - Map k a -
(Maybe a,Map k a)
alter :: Ord k = (Maybe a - Maybe a) - k - Map k a - Map k a

which are the closest that I need. The problem is that the first
doesn't allow the client function to be called if there isn't matching
key in the map and the second is doesn't allow to return value from
the client function. What I really need is an alterLookúp function:

alterLookúp :: Ord k = (Maybe a - (b,Maybe a)) - k - Map k a - (b,Map k a)

The chart manipulation is in the tight loop of my application so I
need fast code. Any other ideas?

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


[Haskell-cafe] Vancouver Haskell users meeting

2008-06-02 Thread Jon Strait
Anyone else here from Vancouver (Canada)?  I thought it would be great 
to have a little informal get-together at a local cafe and share how 
we're currently using Haskell, or really anything (problems,  
comparisons, useful software tools, etc.) in relation to Haskell.


I'm scheduling a meeting for this Thursday, June 5th. for 7PM at 
http://www.waazubee.com/content/directions.php Waazubee Cafe - 
http://www.waazubee.com/content/directions.php  (at Commercial Dr. and 
1st Ave.) 

They have wireless internet access.  I'll get a table near the back, 
bring my laptop, and will have a copy of Hudak's SOE book (the front 
cover is impossible to miss) out on the table.


If anyone wants to meet, but this Thursday is not a good day for you, 
let me know what days are better and we'll move the meeting.  If anyone 
is sure that they will come this Thursday, you might let me know, so I 
can have an idea about the resistance in changing the day, if needed.


Thanks,

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


Re: [Haskell-cafe] Vancouver Haskell users meeting

2008-06-02 Thread Don Stewart
jstrait:
 Anyone else here from Vancouver (Canada)?  I thought it would be great 
 to have a little informal get-together at a local cafe and share how 
 we're currently using Haskell, or really anything (problems,  
 comparisons, useful software tools, etc.) in relation to Haskell.
 
 I'm scheduling a meeting for this Thursday, June 5th. for 7PM at 
 http://www.waazubee.com/content/directions.php Waazubee Cafe - 
 http://www.waazubee.com/content/directions.php  (at Commercial Dr. and 
 1st Ave.) 
 
 They have wireless internet access.  I'll get a table near the back, 
 bring my laptop, and will have a copy of Hudak's SOE book (the front 
 cover is impossible to miss) out on the table.
 
 If anyone wants to meet, but this Thursday is not a good day for you, 
 let me know what days are better and we'll move the meeting.  If anyone 
 is sure that they will come this Thursday, you might let me know, so I 
 can have an idea about the resistance in changing the day, if needed.

Great! I've added these details to the events listing on http://haskell.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Implementing ParseChart with Data.Map

2008-06-02 Thread Neil Mitchell
Hi Krasimir,

 insert :: k - v - Chart k v - Maybe (Chart k v)

 where the result is (Just _) if the (k,v) is actually added to the
 chart or Nothing if it was already there and nothing have to be done.

insertLookupWithKey :: Ord k = (k - a - a - a) - k - a - Map k
a - (Maybe a, Map k a)

This should provide the information you need, without the double
traversal of the data structure.

Thanks

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


Re: [Haskell-cafe] hs-plugins compile error

2008-06-02 Thread Thomas Hartman
after darcs record,

 darcs send -o file.patch

and then send file.patch via email to the maintainer.

2008/6/2 Edsko de Vries [EMAIL PROTECTED]:
 Hi Don,

 Is this the kind of thing you mean (I'm not really a darcs user; this is
 the patch created by darcs record):

 [Hide some names to remove ambiguity errors
 Edsko de Vries [EMAIL PROTECTED]**20080602202001] {
 hunk ./src/System/Plugins/Env.hs 76
 -import Distribution.Package
 +import Distribution.Package hiding (packageName)
 hunk ./src/System/Plugins/PackageAPI.hs 43
 -import Distribution.Package
 +import Distribution.Package hiding (depends, packageName)
 hunk ./src/System/Plugins/ParsePkgConfCabal.hs 9
 -import Distribution.Package
 +import Distribution.Package hiding (depends)
 }

 Edsko
 ___
 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] Implementing ParseChart with Data.Map

2008-06-02 Thread Duncan Coutts

On Mon, 2008-06-02 at 22:35 +0200, Krasimir Angelov wrote:

 The problem with this is that both the Map and the Set are traversed
 twice. The first time from lookup/member and the second time from
 insert. Does someone have an idea how to do this with the current
 libraries?


 The chart manipulation is in the tight loop of my application so I
 need fast code. Any other ideas?

I'm not sure if it helps your application but we had a discussion on
#haskell the other day about Data.Map and were talking about a general
insert/modify/delete operator like:

modify :: k - Map k e - (e, Maybe e - Map k e)

so it's a lookup that returns the element at k and also a continuation
that lets you rebuild a new map with an altered element. I guess that
doesn't account for the element not existing. There's probably a
generalisation that does.

Duncan

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


Re: [Haskell-cafe] cabal install fail for happs-hsp-template

2008-06-02 Thread Duncan Coutts

On Mon, 2008-06-02 at 09:42 -0700, Thomas Hartman wrote:
 Can cabal install be made to work for this package?
 *
 [EMAIL PROTECTED]:~sudo cabal install happs-hsp-template
 [sudo] password for thartman:
 cabal: internal error: could not construct a valid install plan.
 The proposed (invalid) plan contained the following problems:
 Package Cabal is required by several packages, but they require
 inconsistent versions:
   package ghc-6.8.2 requires Cabal-1.2.3.0
   package plugins-1.2 requires Cabal-1.5.2

The package deps are not actually inconsistent, the problem is that the
current cabal-install dependency resolution algorithm is completely
naive and comes up with an invalid install plan.

I'll let people know when the new dep resolver for cabal-install is
ready (hopefully just a few days now). It should address this issue.

Duncan

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


Re: [Haskell-cafe] Implementing ParseChart with Data.Map

2008-06-02 Thread Krasimir Angelov
Not completely! This is a possible implementation:

case insertLookupWithKey (\_ - Set.union) k (Set.singleton v) chart of
  (Nothing, chart) - Just chart
  (Just set, chart) | Set.member v set - Nothing
  | otherwise - Just chart

but notice that the set is still traversed twice.

On Tue, Jun 3, 2008 at 12:07 AM, Neil Mitchell [EMAIL PROTECTED] wrote:
 Hi Krasimir,

 insert :: k - v - Chart k v - Maybe (Chart k v)

 where the result is (Just _) if the (k,v) is actually added to the
 chart or Nothing if it was already there and nothing have to be done.

 insertLookupWithKey :: Ord k = (k - a - a - a) - k - a - Map k
 a - (Maybe a, Map k a)

 This should provide the information you need, without the double
 traversal of the data structure.

 Thanks

 Neil

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


Re: [Haskell-cafe] Implementing ParseChart with Data.Map

2008-06-02 Thread Neil Mitchell
Hi

 case insertLookupWithKey (\_ - Set.union) k (Set.singleton v) chart of
  (Nothing, chart) - Just chart
  (Just set, chart) | Set.member v set - Nothing
  | otherwise - Just chart

 but notice that the set is still traversed twice.

Yes, I missed that bit. I don't see any way of reducing that, other
than using an unsafePerformIO and IORef to track the combining
function - which is probably a really bad idea.

Thanks

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


Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-06-02 Thread Ryan Ingram
On 5/30/08, Martin Blais [EMAIL PROTECTED] wrote:
 Dear Philip, could you point your virtual finger towards a
 reference/paper/book/any-bleeping-thing that would help this simple
 beginner understand why it doesn't work in this case? I'm trying to
 picture why a read function that terminates the program would be
 useful anywhere. In fact, any library function other than something like
 UNIX's exit or kill which terminates my program is not really
 welcome in any of my computer programs, but then again, I haven't yet
 been illuminated by the genie of pure functional languages.  A reference
 would be awesome.

As others have pointed out, the reason why it doesn't work is due to
lazy evaluation; the exception is hidden in a pure value and isn't
triggered until some other bit of code causes the pure value to be
evaluated.  You can force the exception to be generated in your catch
block by using seq (or $!, which is implemented using seq).
This forces the evaluation to happen at that point, although there are
a lot of gotchas involved; for Int it works fine, though.

Your question, then, requires asking why would you want to hide an
exception in a pure value?  The answer to that is quite interesting,
but here's a simpler example that might enlighten you:

head :: [a] - a
head (x:_) = x
head _ = error head: empty list

Just as you are required to prove before calling head that you
aren't passing an empty list, for your program to be total, you should
prove before calling read that the string parses properly.  If you
can't provide that proof (because, in this case, the string is
provided by the user), you should be using another function for
parsing.

Don suggested reads to implement maybeRead, which seems like a
great idea to me.

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


Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-06-02 Thread Neil Mitchell
Hi

 The best thing to do is bypass read and use 'reads' to define your
 own safe read.

maybeRead :: Read a = String - Maybe a
maybeRead s = case reads s of
[(x, )] - Just x
_ - Nothing

Or just use the Safe package:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/safe

http://hackage.haskell.org/packages/archive/safe/0.2/doc/html/Safe.html#v%3AreadMay

Thanks

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


Re: [Haskell-cafe] ghc 6.8.2 issue

2008-06-02 Thread Galchin, Vasili
Hi Duncan,

 Not sure I agree the behavior is ok. E.g. here is a build of mmap:

[EMAIL PROTECTED]:~/FTP/Haskell/bytestring-mmap-0.2.0$ runhaskell Setup.lhs
clean
cleaning...
[EMAIL PROTECTED]:~/FTP/Haskell/bytestring-mmap-0.2.0$ runhaskell Setup.lhs
configure
Configuring bytestring-mmap-0.2.0...
[EMAIL PROTECTED]:~/FTP/Haskell/bytestring-mmap-0.2.0$ runhaskell Setup.lhs
build
Preprocessing library bytestring-mmap-0.2.0...
Building bytestring-mmap-0.2.0...
[1 of 3] Compiling System.IO.Posix.MMap.Internal (
System/IO/Posix/MMap/Internal.hs, dist/build/System/IO/Posix/MMap/Internal.o
)
[2 of 3] Compiling System.IO.Posix.MMap.Lazy ( System/IO/Posix/MMap/Lazy.hs,
dist/build/System/IO/Posix/MMap/Lazy.o )
[3 of 3] Compiling System.IO.Posix.MMap ( System/IO/Posix/MMap.hs,
dist/build/System/IO/Posix/MMap.o )
/usr/bin/ar: creating dist/build/libHSbytestring-mmap-0.2.0.a

at this point rebuild and install the unix package ...

[EMAIL PROTECTED]:~/FTP/Haskell/bytestring-mmap-0.2.0$ runhaskell Setup.lhs
clean
cleaning...
[EMAIL PROTECTED]:~/FTP/Haskell/bytestring-mmap-0.2.0$ runhaskell Setup.lhs
configure
Configuring bytestring-mmap-0.2.0...
[EMAIL PROTECTED]:~/FTP/Haskell/bytestring-mmap-0.2.0$ runhaskell Setup.lhs
build
Setup.lhs: error reading dist/setup-config; run setup configure command?

dist/setup-config is not being populated at the end. In your response
below, are you saying that teh segfaults occur because ghc itself relies on
the unix package?

Thanks, Vasili




On Mon, Jun 2, 2008 at 5:38 AM, Duncan Coutts [EMAIL PROTECTED]
wrote:


 On Mon, 2008-06-02 at 00:07 -0500, Galchin, Vasili wrote:
  Hello,
 
I have been developing new code for the unix package. I have
  run into what I think are ghc 6.8.2 anomalies but couldn't see a
  pattern. Possibly now I do. I have been using the 32-bit x86 ghc
  binary that I downloaded from http://www.haskell.org and running on
  Ubuntu Linux. I am pretty I can repeat now. Everything is ok until I
  do sudo runhaskell Setup.hs install which installs a new unix
  package that I just built. Of course the intall installs
  into /usr/local/lib/unix-2.3.0.0/ghc-6.8.2. The install seems to
  destroy some ghc compiler state under /usr/local ...

 That sounds right. You're replacing the unix-2.3.0.0 library that comes
 with ghc-6.8.2 with your own version. It is highly unlikely to be ABI
 compatible with the one you are replacing and so all the other packages
 that already depends on the existing unix-2.3.0.0 library end up broken.
 You'd expect this kind of breakage to be exposed as link errors and
 segfaults.

 I suggest you do not replace any of the libraries that come with ghc. To
 be more precise, it is perfectly ok to *add new versions* but it is not
 ok to *replace existing versions* without rebuilding all the other libs
 that depend on it.

 Make sense?

 So if you really want to make changes to the unix lib, make sure you
 change the version number too. I also suggest not installing the
 packages as root, just install them locally. That way you can guarantee
 you never mess up your ghc install. You would be able to revert to a
 clean ghc install just by removing your
 ~/.ghc/$arch/ghc-6.8.2/package.conf file which will unregister *all*
 locally registered packages. To unregister individual packages use
 ghc-pkg --user unregister $pkgname

 Duncan


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


Re: [Haskell-cafe] Mutually Recursive Modules

2008-06-02 Thread ajb

G'day all.

Quoting Isaac Dupree [EMAIL PROTECTED]:


Luckily,
it is very often the case that your code will be better off anyway if
refactored to have less module recursion. (though not always.)


Nonetheless, I prefer not to leave the robustness of my code to luck.
Besides, if I liked structuring code around artificial language
restrictions, I'd be programming in C, not Haskell.

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


Re: [Haskell-cafe] ghc 6.8.2 issue

2008-06-02 Thread Galchin, Vasili
Duncan,

 By installing localling, I runhaskell Setup.hs configure
--prefix=$HOME plus add local path to LD_LIBRARY_PATH and LD_RUN_PATH? On
Linux, does ghc use .so's or is it linked statically?

Vasili

On Mon, Jun 2, 2008 at 5:38 AM, Duncan Coutts [EMAIL PROTECTED]
wrote:


 On Mon, 2008-06-02 at 00:07 -0500, Galchin, Vasili wrote:
  Hello,
 
I have been developing new code for the unix package. I have
  run into what I think are ghc 6.8.2 anomalies but couldn't see a
  pattern. Possibly now I do. I have been using the 32-bit x86 ghc
  binary that I downloaded from http://www.haskell.org and running on
  Ubuntu Linux. I am pretty I can repeat now. Everything is ok until I
  do sudo runhaskell Setup.hs install which installs a new unix
  package that I just built. Of course the intall installs
  into /usr/local/lib/unix-2.3.0.0/ghc-6.8.2. The install seems to
  destroy some ghc compiler state under /usr/local ...

 That sounds right. You're replacing the unix-2.3.0.0 library that comes
 with ghc-6.8.2 with your own version. It is highly unlikely to be ABI
 compatible with the one you are replacing and so all the other packages
 that already depends on the existing unix-2.3.0.0 library end up broken.
 You'd expect this kind of breakage to be exposed as link errors and
 segfaults.

 I suggest you do not replace any of the libraries that come with ghc. To
 be more precise, it is perfectly ok to *add new versions* but it is not
 ok to *replace existing versions* without rebuilding all the other libs
 that depend on it.

 Make sense?

 So if you really want to make changes to the unix lib, make sure you
 change the version number too. I also suggest not installing the
 packages as root, just install them locally. That way you can guarantee
 you never mess up your ghc install. You would be able to revert to a
 clean ghc install just by removing your
 ~/.ghc/$arch/ghc-6.8.2/package.conf file which will unregister *all*
 locally registered packages. To unregister individual packages use
 ghc-pkg --user unregister $pkgname

 Duncan


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