Re: [Haskell-cafe] Constructing a datatype given just its constructor as a string?

2007-06-24 Thread Tomasz Zielonka
On Sun, Jun 24, 2007 at 10:55:40PM +0200, Hugh Perkins wrote:
> Anyway, the jist of our conversation was that it's not possible to create
> arbitrary datatypes/constructors from strings in Haskell.  Can anyone
> deny/confirm?

If you want a function like fromConstr, where the 'a' depends on the
input string, you can write it in CPS or wrap the result in an
existential datatype. But I guess the problem is with "arbitrary",
right?

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


[Haskell-cafe] Practical Haskell question.

2007-06-24 Thread Michael T. Richter
Now I've got a situation I can't figure out how to resolve.  I want to
have a set of actions which are executed sequentially, but which, before
I even start to execute the first one, have been inspected for legality
and/or plausibility.  Consider this kind of sequence:

do
  x <- performActionA
  y <- performActionB
  z <- performActionC
  return $ calculateStuff x y z

Now obviously this is going to be in a monad of some kind.  Were this a
regular, run-of-the-mill program I'd just use the IO monad.  But what I
want to do instead is, before executing any of the perform* functions,
check that the actions desired are actually permitted (or possible)
given a set of circumstances.  For example let's say it's a permissions
issue and performActionB can only be done if I'm root.  If I'm not root
I don't want performActionA done because I can't complete the
transaction.  (Maybe ActionA is non-reversible, say.)  Or let's say this
is code that's accessing databases on the network.  If the network link
to C can't be established, I don't want to screw around with A and B's
links at all -- it's too expensive, too time-consuming or whatever.

Were I programming this in C, C++, Python, Ruby, etc. I could do this in
my sleep.  Functions are addresses (C/C++) or objects with an ID
(Python/Ruby) so it's possible to take them and do some kind of check
based on identities before executing things (although the scaffolding
around this would be nontrivial in any of these languages except,
possibly, Ruby).  Functions in Haskell don't have this property,
however, so I can't figure out what I'd do to perform similar work.  I'm
sure there's a way to do it, but I just can't see it.

-- 
Michael T. Richter <[EMAIL PROTECTED]> (GoogleTalk:
[EMAIL PROTECTED])
I'm not schooled in the science of human factors, but I suspect surprise
is not an element of a robust user interface. (Chip Rosenthal)


signature.asc
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] Constructing a datatype given just its constructor as a string?

2007-06-24 Thread Donald Bruce Stewart
hughperkins:
> 
>Just noticed that all my responses have been going only to
>Neil, not  to the group.
>Anyway, the jist of our conversation was that it's not
>possible to create arbitrary datatypes/constructors from
>strings in Haskell.  Can anyone deny/confirm?

Entirely possible. Though it would be interesting to see the code that
is to process the arbitrary types as they arrive, after deserialising.

Anyway there was a thread on this last week. One solution is to have a
symbol table mapping type reps to values of a given type, then you use
that to know which type to read from the constructor tag, resolving the
problem of not knowing what type you're reading.

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


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Jimmy Miller

I'll look at those.

Everything's working fine now, thanks for all of your help :)

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:

I found the examples included in the source code very helpful.

   http://darcs.haskell.org/packages/GLUT/examples/

I think the RedBook directory contains the most examples.

If you want to know the modules a package exports you can use, e.g..

$ ghc-pkg describe OpenGL
name: OpenGL
version: 2.2.1
license: BSD3
copyright:
maintainer: [EMAIL PROTECTED]
stability:
homepage:
package-url:
description:
category:
author:
exposed: True
exposed-modules: Graphics.Rendering.OpenGL.GL.Antialiasing
  Graphics.Rendering.OpenGL.GL.BasicTypes
  [...]

These are the full names of the modules, you have to use to import
them.  For GLUT there's one module that re-exports all others, iirc.

/ Thomas

On 25 jun 2007, at 01.21, Jimmy Miller wrote:

> I got the packages imported by using the full names (Graphics.UI.GLUT
> and Graphics.Rendering.OpenGL.GL).  The compiler doesn't recognize
> names like WindowPosition and WindowSize, but I assume that's because
> the code is so out of date (this is from the 2001 tutorial).  I'll
> look in the docs to see how to procede.
>
> On 6/24/07, Jimmy Miller <[EMAIL PROTECTED]> wrote:
>> Here it is.  Both OpenGL and GLUT are installed:
>> Cabal-1.1.6.2, GLUT-2.1.1, HUnit-1.1.1, OpenGL-2.2.1,
>> QuickCheck-1.0.1, Win32-2.1.1, base-2.1.1, cgi-3001.1.1,
>> fgl-5.4.1,
>> filepath-1.0, (ghc-6.6.1), haskell-src-1.0.1, haskell98-1.0,
>> html-1.0.1, mtl-1.0.1, network-2.0.1, parsec-2.0, regex-
>> base-0.72,
>> regex-compat-0.71, regex-posix-0.71, rts-1.0, stm-2.0,
>> template-haskell-2.1, time-1.1.1, xhtml-3000.0.2
>>
>> I tried using --make, but ghc said "could not find module GL"
>>
>> On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> >
>> > On 25 jun 2007, at 00.18, Jimmy Miller wrote:
>> >
>> > > I've installed ghc 6.6.1, but when I try to compile and OGL
>> program
>> > > like this:
>> > >
>> > > ghc -package GLUT ogl.hs
>> > >
>> > > I get the error:
>> > > Failed to load interface for `GLUT':
>> > >  Use -v to see a list of the files searched for.
>> > >
>> > > I tried running -v, but it doesn't tell me anything useful.
>> >
>> > Can you post the output of "ghc-pkg list"?  If that doesn't list
>> > GLUT, then it is not installed (or not correctly).  If it is
>> > installed, you can try
>> >
>> >ghc --make ogl.hs
>> >
>> > That usually takes care of all the required packages (so can
>> avoid a
>> > lot of fiddling around).
>> >
>> > / Thomas
>> >
>>
>>
>> --
>> http://www.spreadfirefox.com/?
>> q=affiliates&id=153516&t=1">> rows="3" cols="40">Get Firefox!
>>
>
>
> --
> http://www.spreadfirefox.com/?
> q=affiliates&id=153516&t=1"> rows="3" cols="40">Get Firefox!





--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] XmlSerializer.deserialize?

2007-06-24 Thread Udo Stenzel
Hugh Perkins wrote:
> Hi,
> 
> Trying to write a function to deserialize a haskell type from xml.
> 
> deserializeXml :: Data(a) => String -> a

That type signature describes a function that can deliver *anything*
(that is in class Data), whatever you ask from it.  From your
description (also the one in your other mail) it rather sounds as if you
want a function that delivers *something* (only restricted to be in
class Data), with you not asking for anything specific.  The correct
type would be something like:

data Any = forall a . Data a => Any a
deserializeXml :: String -> Any

(The syntax might be very wrong, I don't actually use this weird stuff.)
Now what would you do with the resulting 'Any'?  Pass it to a function
of course:

applyAny :: (forall a . Data a => a -> b) -> Any -> b
applyAny f (Any a) = f a

...and there aren't all that many functions that would fit the bill,
only generic ones.  If you do that, you wind up dragging in all the
machinery of Data.Generic just to implement what HaXml does with much
simpler technology.  I doubt that's what you actually want.

On the other hand, I might be misunderstanding.  In that case,
Data.Generics should have everything you need, in particular gunfold and
friends.


-Udo
-- 
"In the software business there are many enterprises for which it is not
clear that science can help them; that science should try is not clear
either."
-- E. W. Dijkstra


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


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Thomas Schilling

I found the examples included in the source code very helpful.

  http://darcs.haskell.org/packages/GLUT/examples/

I think the RedBook directory contains the most examples.

If you want to know the modules a package exports you can use, e.g..

$ ghc-pkg describe OpenGL
name: OpenGL
version: 2.2.1
license: BSD3
copyright:
maintainer: [EMAIL PROTECTED]
stability:
homepage:
package-url:
description:
category:
author:
exposed: True
exposed-modules: Graphics.Rendering.OpenGL.GL.Antialiasing
 Graphics.Rendering.OpenGL.GL.BasicTypes
 [...]

These are the full names of the modules, you have to use to import  
them.  For GLUT there's one module that re-exports all others, iirc.


/ Thomas

On 25 jun 2007, at 01.21, Jimmy Miller wrote:


I got the packages imported by using the full names (Graphics.UI.GLUT
and Graphics.Rendering.OpenGL.GL).  The compiler doesn't recognize
names like WindowPosition and WindowSize, but I assume that's because
the code is so out of date (this is from the 2001 tutorial).  I'll
look in the docs to see how to procede.

On 6/24/07, Jimmy Miller <[EMAIL PROTECTED]> wrote:

Here it is.  Both OpenGL and GLUT are installed:
Cabal-1.1.6.2, GLUT-2.1.1, HUnit-1.1.1, OpenGL-2.2.1,
QuickCheck-1.0.1, Win32-2.1.1, base-2.1.1, cgi-3001.1.1,  
fgl-5.4.1,

filepath-1.0, (ghc-6.6.1), haskell-src-1.0.1, haskell98-1.0,
html-1.0.1, mtl-1.0.1, network-2.0.1, parsec-2.0, regex- 
base-0.72,

regex-compat-0.71, regex-posix-0.71, rts-1.0, stm-2.0,
template-haskell-2.1, time-1.1.1, xhtml-3000.0.2

I tried using --make, but ghc said "could not find module GL"

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>
> On 25 jun 2007, at 00.18, Jimmy Miller wrote:
>
> > I've installed ghc 6.6.1, but when I try to compile and OGL  
program

> > like this:
> >
> > ghc -package GLUT ogl.hs
> >
> > I get the error:
> > Failed to load interface for `GLUT':
> >  Use -v to see a list of the files searched for.
> >
> > I tried running -v, but it doesn't tell me anything useful.
>
> Can you post the output of "ghc-pkg list"?  If that doesn't list
> GLUT, then it is not installed (or not correctly).  If it is
> installed, you can try
>
>ghc --make ogl.hs
>
> That usually takes care of all the required packages (so can  
avoid a

> lot of fiddling around).
>
> / Thomas
>


--
http://www.spreadfirefox.com/? 
q=affiliates&id=153516&t=1">
rows="3" cols="40">Get Firefox!




--
http://www.spreadfirefox.com/? 
q=affiliates&id=153516&t=1">
rows="3" cols="40">Get Firefox!


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


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Jimmy Miller

I got the packages imported by using the full names (Graphics.UI.GLUT
and Graphics.Rendering.OpenGL.GL).  The compiler doesn't recognize
names like WindowPosition and WindowSize, but I assume that's because
the code is so out of date (this is from the 2001 tutorial).  I'll
look in the docs to see how to procede.

On 6/24/07, Jimmy Miller <[EMAIL PROTECTED]> wrote:

Here it is.  Both OpenGL and GLUT are installed:
Cabal-1.1.6.2, GLUT-2.1.1, HUnit-1.1.1, OpenGL-2.2.1,
QuickCheck-1.0.1, Win32-2.1.1, base-2.1.1, cgi-3001.1.1, fgl-5.4.1,
filepath-1.0, (ghc-6.6.1), haskell-src-1.0.1, haskell98-1.0,
html-1.0.1, mtl-1.0.1, network-2.0.1, parsec-2.0, regex-base-0.72,
regex-compat-0.71, regex-posix-0.71, rts-1.0, stm-2.0,
template-haskell-2.1, time-1.1.1, xhtml-3000.0.2

I tried using --make, but ghc said "could not find module GL"

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>
> On 25 jun 2007, at 00.18, Jimmy Miller wrote:
>
> > I've installed ghc 6.6.1, but when I try to compile and OGL program
> > like this:
> >
> > ghc -package GLUT ogl.hs
> >
> > I get the error:
> > Failed to load interface for `GLUT':
> >  Use -v to see a list of the files searched for.
> >
> > I tried running -v, but it doesn't tell me anything useful.
>
> Can you post the output of "ghc-pkg list"?  If that doesn't list
> GLUT, then it is not installed (or not correctly).  If it is
> installed, you can try
>
>ghc --make ogl.hs
>
> That usually takes care of all the required packages (so can avoid a
> lot of fiddling around).
>
> / Thomas
>


--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!




--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Jimmy Miller

Here it is.  Both OpenGL and GLUT are installed:
   Cabal-1.1.6.2, GLUT-2.1.1, HUnit-1.1.1, OpenGL-2.2.1,
   QuickCheck-1.0.1, Win32-2.1.1, base-2.1.1, cgi-3001.1.1, fgl-5.4.1,
   filepath-1.0, (ghc-6.6.1), haskell-src-1.0.1, haskell98-1.0,
   html-1.0.1, mtl-1.0.1, network-2.0.1, parsec-2.0, regex-base-0.72,
   regex-compat-0.71, regex-posix-0.71, rts-1.0, stm-2.0,
   template-haskell-2.1, time-1.1.1, xhtml-3000.0.2

I tried using --make, but ghc said "could not find module GL"

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:


On 25 jun 2007, at 00.18, Jimmy Miller wrote:

> I've installed ghc 6.6.1, but when I try to compile and OGL program
> like this:
>
> ghc -package GLUT ogl.hs
>
> I get the error:
> Failed to load interface for `GLUT':
>  Use -v to see a list of the files searched for.
>
> I tried running -v, but it doesn't tell me anything useful.

Can you post the output of "ghc-pkg list"?  If that doesn't list
GLUT, then it is not installed (or not correctly).  If it is
installed, you can try

   ghc --make ogl.hs

That usually takes care of all the required packages (so can avoid a
lot of fiddling around).

/ Thomas




--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] directory tree?

2007-06-24 Thread Chad Scherrer

Thanks, Bryan, this is much cleaner than the imperative hack I was
throwing together. And aside from the imports, it even fits the
"couple lines of code" criteria! Wonderful.

I won't be able to try this out until I get back to work, but I'm
wondering whether this will handle a few thousand files. As it is,
even the "gunzip -c ./2*/*.z" I'm trying to emulate doesn't really
work as is, because the OS complains there are too many pattern
matches.

Does "namesMatching" just feed the pattern to the OS, or does it match
the pattern itself?

Chad


> What got me thinking about this is I'd like to be able to do something
> like this in just a couple lines of code:
>
> gunzip -c ./2*/*.z
>
> ... and feed the result into a giant lazy ByteString.

Using my FileManip library, you'd do that like this.

import Codec.Compression.GZip
import qualified Data.ByteString.Lazy as B
import System.FilePath.Glob

foo :: IO B.ByteString
foo = namesMatching "*/*.gz" >>=
   fmap B.concat . mapM (fmap decompress . B.readFile)

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


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Thomas Schilling


On 25 jun 2007, at 00.18, Jimmy Miller wrote:

I've installed ghc 6.6.1, but when I try to compile and OGL program  
like this:


ghc -package GLUT ogl.hs

I get the error:
Failed to load interface for `GLUT':
 Use -v to see a list of the files searched for.

I tried running -v, but it doesn't tell me anything useful.


Can you post the output of "ghc-pkg list"?  If that doesn't list  
GLUT, then it is not installed (or not correctly).  If it is  
installed, you can try


  ghc --make ogl.hs

That usually takes care of all the required packages (so can avoid a  
lot of fiddling around).


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


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Jimmy Miller

I've installed ghc 6.6.1, but when I try to compile and OGL program like this:

ghc -package GLUT ogl.hs

I get the error:
Failed to load interface for `GLUT':
 Use -v to see a list of the files searched for.

I tried running -v, but it doesn't tell me anything useful.

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:

Yes, the OpenGL website seems unmaintained.  I presume the easiest
way to set it all up is to use the installer from
   http://www.haskell.org/ghc/download_ghc_661.html#windows

 From the size of it it seems to include all the extra packages.

/ Thomas

On 24 jun 2007, at 21.50, Jimmy Miller wrote:

> I already installed Cygwin; I'll go over the INSTALL file and make
> sure I have all the required packages.
>
> And there was an HOpenGL tutorial from 2001 that said OpenGL would
> eventually be packaged with ghc, but I tried -package OpenGL and that
> didn't work, and I'm not sure where else I could download it.
>
> On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>>
>> On 24 jun 2007, at 19.53, Jimmy Miller wrote:
>>
>> > Thanks, didn't know that.
>> > Here's the configure output:
>> >
>> > Configuring OpenGL-2.1...
>> > configure: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
>> > configure: Dependency base-any: using base-2.0
>> > configure: Using install prefix: C:\Program Files
>> > configure: Binaries installed in: C:\Program Files\Haskell\bin
>> > configure: Libraries installed in: C:\Program Files\Haskell
>> > \OpenGL-2.1\ghc-6.6
>> > configure: Private binaries installed in: C:\Program Files
>> \OpenGL-2.1
>> > configure: Data files installed in: C:\Program Files\Common Files
>> > \OpenGL-2.1
>> > configure: Using compiler: C:\ghc\ghc-6.6\bin\ghc.exe
>> > configure: Compiler flavor: GHC
>> > configure: Compiler version: 6.6
>> > configure: Using package tool: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
>> > configure: Using ar found on system at: C:\ghc\ghc-6.6\bin\ar.exe
>> > configure: No haddock found
>> > configure: No pfesetup found
>> > configure: No ranlib found
>> > configure: Using runghc found on system at: C:\ghc\ghc-6.6\bin
>> > \runghc.exe
>> > configure: No runhugs found
>> > configure: No happy found
>> > configure: No alex found
>> > configure: Using hsc2hs: C:\ghc\ghc-6.6\bin\hsc2hs.exe
>> > configure: No c2hs found
>> > configure: No cpphs found
>> > configure: No greencard found
>> > Setup.hs: Cannot find: sh
>> >
>>
>> Oh.  This is an error during configuration.  I guess we could make
>> cabal be more clear about this.
>>
>> You probably have to install cygwin, I don't have any Windows system,
>> so I don't know.  I presume the easiest option would be some binary
>> distribution.  Isn't OpenGL part of GHC's extra packages?
>>
>>
>> > On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> >> No, ffi is no extra package.  It would be helpful if you posted
>> you
>> >> configure output though.
>> >>
>> >> BTW, please CC the list when replying.  The easiest way should
>> be to
>> >> use the "reply all" feature of your mail client.
>> >>
>> >> Thanks,
>> >>
>> >> Thomas
>> >>
>> >>
>> >> On 24 jun 2007, at 15.24, Jimmy Miller wrote:
>> >>
>> >> > That's all I know right now.  Is there another package I need to
>> >> > install for the C FFI?  Also, is there any problem in Setup.hs
>> >> saying
>> >> > that sh was not found?
>> >> >
>> >> > On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> >> >> That looks like a missing C macro definition.  It should
>> probably
>> >> >> expand to either stdcall or ccall.  A bit more information
>> >> would be
>> >> >> helpful.
>> >> >>
>> >> >>
>> >> >> On 24 jun 2007, at 13.11, Jimmy Miller wrote:
>> >> >>
>> >> >> > I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows
>> XP.
>> >> >> > runghc Setup.hs configure seems to work fine.  It gives
>> messages
>> >> >> about
>> >> >> > things missing, like sh, but there are no errors.
>> >> >> >
>> >> >> > When I run runghc Setup.hs build, I get the following error:
>> >> >> >
>> >> >> > [ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions
>> >> >> > ( Graphics/Renderin
>> >> >> > g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/
>> >> OpenGL/GL/
>> >> >> > Extensions.o
>> >> >> > )
>> >> >> >
>> >> >> > Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
>> >> >> >parse error on input `CALLCONV'
>> >> >> >
>> >> >> > Does anyone know what might be going wrong?
>> >> >> >
>> >> >> > --
>> >> >> > http://www.spreadfirefox.com/?
>> >> >> > q=affiliates&id=153516&t=1">> >> >> > rows="3" cols="40">Get Firefox!
>> >> >> > ___
>> >> >> > Haskell-Cafe mailing list
>> >> >> > Haskell-Cafe@haskell.org
>> >> >> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > http://www.spreadfirefox.com/?
>> >> > q=affiliates&id=153516&t=1">> >> > rows="3" cols="40">Get Firefox!
>> >>
>> >>
>> >
>> >
>> > --
>> > http://www.spreadfirefox.com/?
>> > q=affiliates&id=153516&t=1">> > rows="3" 

[Haskell-cafe] Re: copy-on-write monad?

2007-06-24 Thread Greg Meredith

Oleg,

Once again, many thanks. This is great info. BTW, i realized that my
approach has an underlying process algebraic formulation. Roughly speaking,
you can think of the mutable collection as a tuple space in which the names
of the tuple space are the mutable locations in the collection. Updates
correspond to persistent (i.e. replicated) outputs, accesses correspond to
inputs. There is a natural interpretation of this approach in terms of
delimited continuations; but, i think the other way round -- interpreting
delimited continuations in terms of process algebraic operations -- is
actually more natural.

Best wishes,

--greg

On 6/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:



Greg Meredith wrote:
> First, has anyone worked out a monadic
> approach to copy-on-write? (And, Is there any analysis of perf
> characteristics of said monadic schemes?)

If you use Zippers (Huet's or generic ones) with functional updates,
copy-on-write comes out automatically and by default. This is
explained in
http://okmij.org/ftp/Computation/Continuations.html#zipper
and, in a more readable form, in a recent paper
http://okmij.org/ftp/papers/context-OS.pdf

The web page also contains the complete code.





--
L.G. Meredith
Managing Partner
Biosimilarity LLC
505 N 72nd St
Seattle, WA 98103

+1 206.650.3740

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


Re: [Haskell-cafe] XmlSerializer.deserialize?

2007-06-24 Thread Hugh Perkins

Yes, or better:

gshow' :: Data a => a -> String
gshow' t = fromMaybe (showConstr(toConstr t)) (cast t)

(which gets rid of the parentheses around numbers).

Still doesnt get a deserialize though ;-)

On 6/24/07, Andrea Vezzosi <[EMAIL PROTECTED]> wrote:


As a side note i'd like to point out that introspectData has a problem
with constructors containing Strings because show (x::String) /= x:

data Foo = Foo { bar :: String } deriving (Typeable,Data)

introspectData (Foo "quux") --> [("bar","\"quux\"")]

Those extras \" don't look very nice in the xml.. (the output of
introspectData is also wrong in the article's example )
you should probably use a modified gshow:

gshow' :: Data a => a -> String
gshow' x = fromMaybe (gshow x) (cast x)

which is id for Strings.




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


Re: [Haskell-cafe] Constructing a datatype given just its constructor as a string?

2007-06-24 Thread Hugh Perkins

Just noticed that all my responses have been going only to Neil, not  to the
group.

Anyway, the jist of our conversation was that it's not possible to create
arbitrary datatypes/constructors from strings in Haskell.  Can anyone
deny/confirm?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Thomas Schilling
Yes, the OpenGL website seems unmaintained.  I presume the easiest  
way to set it all up is to use the installer from

  http://www.haskell.org/ghc/download_ghc_661.html#windows

From the size of it it seems to include all the extra packages.

/ Thomas

On 24 jun 2007, at 21.50, Jimmy Miller wrote:


I already installed Cygwin; I'll go over the INSTALL file and make
sure I have all the required packages.

And there was an HOpenGL tutorial from 2001 that said OpenGL would
eventually be packaged with ghc, but I tried -package OpenGL and that
didn't work, and I'm not sure where else I could download it.

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:


On 24 jun 2007, at 19.53, Jimmy Miller wrote:

> Thanks, didn't know that.
> Here's the configure output:
>
> Configuring OpenGL-2.1...
> configure: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
> configure: Dependency base-any: using base-2.0
> configure: Using install prefix: C:\Program Files
> configure: Binaries installed in: C:\Program Files\Haskell\bin
> configure: Libraries installed in: C:\Program Files\Haskell
> \OpenGL-2.1\ghc-6.6
> configure: Private binaries installed in: C:\Program Files 
\OpenGL-2.1

> configure: Data files installed in: C:\Program Files\Common Files
> \OpenGL-2.1
> configure: Using compiler: C:\ghc\ghc-6.6\bin\ghc.exe
> configure: Compiler flavor: GHC
> configure: Compiler version: 6.6
> configure: Using package tool: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
> configure: Using ar found on system at: C:\ghc\ghc-6.6\bin\ar.exe
> configure: No haddock found
> configure: No pfesetup found
> configure: No ranlib found
> configure: Using runghc found on system at: C:\ghc\ghc-6.6\bin
> \runghc.exe
> configure: No runhugs found
> configure: No happy found
> configure: No alex found
> configure: Using hsc2hs: C:\ghc\ghc-6.6\bin\hsc2hs.exe
> configure: No c2hs found
> configure: No cpphs found
> configure: No greencard found
> Setup.hs: Cannot find: sh
>

Oh.  This is an error during configuration.  I guess we could make
cabal be more clear about this.

You probably have to install cygwin, I don't have any Windows system,
so I don't know.  I presume the easiest option would be some binary
distribution.  Isn't OpenGL part of GHC's extra packages?


> On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> No, ffi is no extra package.  It would be helpful if you posted  
you

>> configure output though.
>>
>> BTW, please CC the list when replying.  The easiest way should  
be to

>> use the "reply all" feature of your mail client.
>>
>> Thanks,
>>
>> Thomas
>>
>>
>> On 24 jun 2007, at 15.24, Jimmy Miller wrote:
>>
>> > That's all I know right now.  Is there another package I need to
>> > install for the C FFI?  Also, is there any problem in Setup.hs
>> saying
>> > that sh was not found?
>> >
>> > On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> >> That looks like a missing C macro definition.  It should  
probably

>> >> expand to either stdcall or ccall.  A bit more information
>> would be
>> >> helpful.
>> >>
>> >>
>> >> On 24 jun 2007, at 13.11, Jimmy Miller wrote:
>> >>
>> >> > I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows  
XP.
>> >> > runghc Setup.hs configure seems to work fine.  It gives  
messages

>> >> about
>> >> > things missing, like sh, but there are no errors.
>> >> >
>> >> > When I run runghc Setup.hs build, I get the following error:
>> >> >
>> >> > [ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions
>> >> > ( Graphics/Renderin
>> >> > g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/
>> OpenGL/GL/
>> >> > Extensions.o
>> >> > )
>> >> >
>> >> > Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
>> >> >parse error on input `CALLCONV'
>> >> >
>> >> > Does anyone know what might be going wrong?
>> >> >
>> >> > --
>> >> > http://www.spreadfirefox.com/?
>> >> > q=affiliates&id=153516&t=1">> >> > rows="3" cols="40">Get Firefox!
>> >> > ___
>> >> > Haskell-Cafe mailing list
>> >> > Haskell-Cafe@haskell.org
>> >> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>> >>
>> >>
>> >
>> >
>> > --
>> > http://www.spreadfirefox.com/?
>> > q=affiliates&id=153516&t=1">> > rows="3" cols="40">Get Firefox!
>>
>>
>
>
> --
> http://www.spreadfirefox.com/?
> q=affiliates&id=153516&t=1"> rows="3" cols="40">Get Firefox!





--
http://www.spreadfirefox.com/? 
q=affiliates&id=153516&t=1">
rows="3" cols="40">Get Firefox!


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


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Jimmy Miller

I added Cygwin to my path so sh can be found, but now configure tells
me "c compiler cannot create executables"

On 6/24/07, Jimmy Miller <[EMAIL PROTECTED]> wrote:

I already installed Cygwin; I'll go over the INSTALL file and make
sure I have all the required packages.

And there was an HOpenGL tutorial from 2001 that said OpenGL would
eventually be packaged with ghc, but I tried -package OpenGL and that
didn't work, and I'm not sure where else I could download it.

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>
> On 24 jun 2007, at 19.53, Jimmy Miller wrote:
>
> > Thanks, didn't know that.
> > Here's the configure output:
> >
> > Configuring OpenGL-2.1...
> > configure: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
> > configure: Dependency base-any: using base-2.0
> > configure: Using install prefix: C:\Program Files
> > configure: Binaries installed in: C:\Program Files\Haskell\bin
> > configure: Libraries installed in: C:\Program Files\Haskell
> > \OpenGL-2.1\ghc-6.6
> > configure: Private binaries installed in: C:\Program Files\OpenGL-2.1
> > configure: Data files installed in: C:\Program Files\Common Files
> > \OpenGL-2.1
> > configure: Using compiler: C:\ghc\ghc-6.6\bin\ghc.exe
> > configure: Compiler flavor: GHC
> > configure: Compiler version: 6.6
> > configure: Using package tool: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
> > configure: Using ar found on system at: C:\ghc\ghc-6.6\bin\ar.exe
> > configure: No haddock found
> > configure: No pfesetup found
> > configure: No ranlib found
> > configure: Using runghc found on system at: C:\ghc\ghc-6.6\bin
> > \runghc.exe
> > configure: No runhugs found
> > configure: No happy found
> > configure: No alex found
> > configure: Using hsc2hs: C:\ghc\ghc-6.6\bin\hsc2hs.exe
> > configure: No c2hs found
> > configure: No cpphs found
> > configure: No greencard found
> > Setup.hs: Cannot find: sh
> >
>
> Oh.  This is an error during configuration.  I guess we could make
> cabal be more clear about this.
>
> You probably have to install cygwin, I don't have any Windows system,
> so I don't know.  I presume the easiest option would be some binary
> distribution.  Isn't OpenGL part of GHC's extra packages?
>
>
> > On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
> >> No, ffi is no extra package.  It would be helpful if you posted you
> >> configure output though.
> >>
> >> BTW, please CC the list when replying.  The easiest way should be to
> >> use the "reply all" feature of your mail client.
> >>
> >> Thanks,
> >>
> >> Thomas
> >>
> >>
> >> On 24 jun 2007, at 15.24, Jimmy Miller wrote:
> >>
> >> > That's all I know right now.  Is there another package I need to
> >> > install for the C FFI?  Also, is there any problem in Setup.hs
> >> saying
> >> > that sh was not found?
> >> >
> >> > On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
> >> >> That looks like a missing C macro definition.  It should probably
> >> >> expand to either stdcall or ccall.  A bit more information
> >> would be
> >> >> helpful.
> >> >>
> >> >>
> >> >> On 24 jun 2007, at 13.11, Jimmy Miller wrote:
> >> >>
> >> >> > I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows XP.
> >> >> > runghc Setup.hs configure seems to work fine.  It gives messages
> >> >> about
> >> >> > things missing, like sh, but there are no errors.
> >> >> >
> >> >> > When I run runghc Setup.hs build, I get the following error:
> >> >> >
> >> >> > [ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions
> >> >> > ( Graphics/Renderin
> >> >> > g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/
> >> OpenGL/GL/
> >> >> > Extensions.o
> >> >> > )
> >> >> >
> >> >> > Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
> >> >> >parse error on input `CALLCONV'
> >> >> >
> >> >> > Does anyone know what might be going wrong?
> >> >> >
> >> >> > --
> >> >> > http://www.spreadfirefox.com/?
> >> >> > q=affiliates&id=153516&t=1"> >> >> > rows="3" cols="40">Get Firefox!
> >> >> > ___
> >> >> > Haskell-Cafe mailing list
> >> >> > Haskell-Cafe@haskell.org
> >> >> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > http://www.spreadfirefox.com/?
> >> > q=affiliates&id=153516&t=1"> >> > rows="3" cols="40">Get Firefox!
> >>
> >>
> >
> >
> > --
> > http://www.spreadfirefox.com/?
> > q=affiliates&id=153516&t=1"> > rows="3" cols="40">Get Firefox!
>
>


--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!




--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Jimmy Miller

I already installed Cygwin; I'll go over the INSTALL file and make
sure I have all the required packages.

And there was an HOpenGL tutorial from 2001 that said OpenGL would
eventually be packaged with ghc, but I tried -package OpenGL and that
didn't work, and I'm not sure where else I could download it.

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:


On 24 jun 2007, at 19.53, Jimmy Miller wrote:

> Thanks, didn't know that.
> Here's the configure output:
>
> Configuring OpenGL-2.1...
> configure: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
> configure: Dependency base-any: using base-2.0
> configure: Using install prefix: C:\Program Files
> configure: Binaries installed in: C:\Program Files\Haskell\bin
> configure: Libraries installed in: C:\Program Files\Haskell
> \OpenGL-2.1\ghc-6.6
> configure: Private binaries installed in: C:\Program Files\OpenGL-2.1
> configure: Data files installed in: C:\Program Files\Common Files
> \OpenGL-2.1
> configure: Using compiler: C:\ghc\ghc-6.6\bin\ghc.exe
> configure: Compiler flavor: GHC
> configure: Compiler version: 6.6
> configure: Using package tool: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
> configure: Using ar found on system at: C:\ghc\ghc-6.6\bin\ar.exe
> configure: No haddock found
> configure: No pfesetup found
> configure: No ranlib found
> configure: Using runghc found on system at: C:\ghc\ghc-6.6\bin
> \runghc.exe
> configure: No runhugs found
> configure: No happy found
> configure: No alex found
> configure: Using hsc2hs: C:\ghc\ghc-6.6\bin\hsc2hs.exe
> configure: No c2hs found
> configure: No cpphs found
> configure: No greencard found
> Setup.hs: Cannot find: sh
>

Oh.  This is an error during configuration.  I guess we could make
cabal be more clear about this.

You probably have to install cygwin, I don't have any Windows system,
so I don't know.  I presume the easiest option would be some binary
distribution.  Isn't OpenGL part of GHC's extra packages?


> On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> No, ffi is no extra package.  It would be helpful if you posted you
>> configure output though.
>>
>> BTW, please CC the list when replying.  The easiest way should be to
>> use the "reply all" feature of your mail client.
>>
>> Thanks,
>>
>> Thomas
>>
>>
>> On 24 jun 2007, at 15.24, Jimmy Miller wrote:
>>
>> > That's all I know right now.  Is there another package I need to
>> > install for the C FFI?  Also, is there any problem in Setup.hs
>> saying
>> > that sh was not found?
>> >
>> > On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> >> That looks like a missing C macro definition.  It should probably
>> >> expand to either stdcall or ccall.  A bit more information
>> would be
>> >> helpful.
>> >>
>> >>
>> >> On 24 jun 2007, at 13.11, Jimmy Miller wrote:
>> >>
>> >> > I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows XP.
>> >> > runghc Setup.hs configure seems to work fine.  It gives messages
>> >> about
>> >> > things missing, like sh, but there are no errors.
>> >> >
>> >> > When I run runghc Setup.hs build, I get the following error:
>> >> >
>> >> > [ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions
>> >> > ( Graphics/Renderin
>> >> > g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/
>> OpenGL/GL/
>> >> > Extensions.o
>> >> > )
>> >> >
>> >> > Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
>> >> >parse error on input `CALLCONV'
>> >> >
>> >> > Does anyone know what might be going wrong?
>> >> >
>> >> > --
>> >> > http://www.spreadfirefox.com/?
>> >> > q=affiliates&id=153516&t=1">> >> > rows="3" cols="40">Get Firefox!
>> >> > ___
>> >> > Haskell-Cafe mailing list
>> >> > Haskell-Cafe@haskell.org
>> >> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>> >>
>> >>
>> >
>> >
>> > --
>> > http://www.spreadfirefox.com/?
>> > q=affiliates&id=153516&t=1">> > rows="3" cols="40">Get Firefox!
>>
>>
>
>
> --
> http://www.spreadfirefox.com/?
> q=affiliates&id=153516&t=1"> rows="3" cols="40">Get Firefox!





--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Thomas Schilling


On 24 jun 2007, at 19.53, Jimmy Miller wrote:


Thanks, didn't know that.
Here's the configure output:

Configuring OpenGL-2.1...
configure: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
configure: Dependency base-any: using base-2.0
configure: Using install prefix: C:\Program Files
configure: Binaries installed in: C:\Program Files\Haskell\bin
configure: Libraries installed in: C:\Program Files\Haskell 
\OpenGL-2.1\ghc-6.6

configure: Private binaries installed in: C:\Program Files\OpenGL-2.1
configure: Data files installed in: C:\Program Files\Common Files 
\OpenGL-2.1

configure: Using compiler: C:\ghc\ghc-6.6\bin\ghc.exe
configure: Compiler flavor: GHC
configure: Compiler version: 6.6
configure: Using package tool: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
configure: Using ar found on system at: C:\ghc\ghc-6.6\bin\ar.exe
configure: No haddock found
configure: No pfesetup found
configure: No ranlib found
configure: Using runghc found on system at: C:\ghc\ghc-6.6\bin 
\runghc.exe

configure: No runhugs found
configure: No happy found
configure: No alex found
configure: Using hsc2hs: C:\ghc\ghc-6.6\bin\hsc2hs.exe
configure: No c2hs found
configure: No cpphs found
configure: No greencard found
Setup.hs: Cannot find: sh



Oh.  This is an error during configuration.  I guess we could make  
cabal be more clear about this.


You probably have to install cygwin, I don't have any Windows system,  
so I don't know.  I presume the easiest option would be some binary  
distribution.  Isn't OpenGL part of GHC's extra packages?




On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:

No, ffi is no extra package.  It would be helpful if you posted you
configure output though.

BTW, please CC the list when replying.  The easiest way should be to
use the "reply all" feature of your mail client.

Thanks,

Thomas


On 24 jun 2007, at 15.24, Jimmy Miller wrote:

> That's all I know right now.  Is there another package I need to
> install for the C FFI?  Also, is there any problem in Setup.hs  
saying

> that sh was not found?
>
> On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> That looks like a missing C macro definition.  It should probably
>> expand to either stdcall or ccall.  A bit more information  
would be

>> helpful.
>>
>>
>> On 24 jun 2007, at 13.11, Jimmy Miller wrote:
>>
>> > I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows XP.
>> > runghc Setup.hs configure seems to work fine.  It gives messages
>> about
>> > things missing, like sh, but there are no errors.
>> >
>> > When I run runghc Setup.hs build, I get the following error:
>> >
>> > [ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions
>> > ( Graphics/Renderin
>> > g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/ 
OpenGL/GL/

>> > Extensions.o
>> > )
>> >
>> > Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
>> >parse error on input `CALLCONV'
>> >
>> > Does anyone know what might be going wrong?
>> >
>> > --
>> > http://www.spreadfirefox.com/?
>> > q=affiliates&id=153516&t=1">> > rows="3" cols="40">Get Firefox!
>> > ___
>> > Haskell-Cafe mailing list
>> > Haskell-Cafe@haskell.org
>> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
>
> --
> http://www.spreadfirefox.com/?
> q=affiliates&id=153516&t=1"> rows="3" cols="40">Get Firefox!





--
http://www.spreadfirefox.com/? 
q=affiliates&id=153516&t=1">
rows="3" cols="40">Get Firefox!


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


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Jimmy Miller

Thanks, didn't know that.
Here's the configure output:

Configuring OpenGL-2.1...
configure: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
configure: Dependency base-any: using base-2.0
configure: Using install prefix: C:\Program Files
configure: Binaries installed in: C:\Program Files\Haskell\bin
configure: Libraries installed in: C:\Program Files\Haskell\OpenGL-2.1\ghc-6.6
configure: Private binaries installed in: C:\Program Files\OpenGL-2.1
configure: Data files installed in: C:\Program Files\Common Files\OpenGL-2.1
configure: Using compiler: C:\ghc\ghc-6.6\bin\ghc.exe
configure: Compiler flavor: GHC
configure: Compiler version: 6.6
configure: Using package tool: C:\ghc\ghc-6.6\bin\ghc-pkg.exe
configure: Using ar found on system at: C:\ghc\ghc-6.6\bin\ar.exe
configure: No haddock found
configure: No pfesetup found
configure: No ranlib found
configure: Using runghc found on system at: C:\ghc\ghc-6.6\bin\runghc.exe
configure: No runhugs found
configure: No happy found
configure: No alex found
configure: Using hsc2hs: C:\ghc\ghc-6.6\bin\hsc2hs.exe
configure: No c2hs found
configure: No cpphs found
configure: No greencard found
Setup.hs: Cannot find: sh

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:

No, ffi is no extra package.  It would be helpful if you posted you
configure output though.

BTW, please CC the list when replying.  The easiest way should be to
use the "reply all" feature of your mail client.

Thanks,

Thomas


On 24 jun 2007, at 15.24, Jimmy Miller wrote:

> That's all I know right now.  Is there another package I need to
> install for the C FFI?  Also, is there any problem in Setup.hs saying
> that sh was not found?
>
> On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:
>> That looks like a missing C macro definition.  It should probably
>> expand to either stdcall or ccall.  A bit more information would be
>> helpful.
>>
>>
>> On 24 jun 2007, at 13.11, Jimmy Miller wrote:
>>
>> > I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows XP.
>> > runghc Setup.hs configure seems to work fine.  It gives messages
>> about
>> > things missing, like sh, but there are no errors.
>> >
>> > When I run runghc Setup.hs build, I get the following error:
>> >
>> > [ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions
>> > ( Graphics/Renderin
>> > g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/OpenGL/GL/
>> > Extensions.o
>> > )
>> >
>> > Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
>> >parse error on input `CALLCONV'
>> >
>> > Does anyone know what might be going wrong?
>> >
>> > --
>> > http://www.spreadfirefox.com/?
>> > q=affiliates&id=153516&t=1">> > rows="3" cols="40">Get Firefox!
>> > ___
>> > Haskell-Cafe mailing list
>> > Haskell-Cafe@haskell.org
>> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
>
> --
> http://www.spreadfirefox.com/?
> q=affiliates&id=153516&t=1"> rows="3" cols="40">Get Firefox!





--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] problem implementing an EDSL in Haskell

2007-06-24 Thread Conal Elliott

Hi Daniil,

By "embedded" DSL, we usually mean identifying meta-language (Haskell)
expressions with object language (DSL) expressions, rather than having an
"Exp" data type.  Then you just use meta-language variables as
object-language variables.  The new data types you introduce are then
domain-oriented rather than language-oriented.  Is there a reason that this
kind of "embedded" approach doesn't work for you?

Cheers,  - Conal

On 6/7/07, Daniil Elovkov <[EMAIL PROTECTED]> wrote:


Hello folks

Haskell is considered good for embedded DSLs. I'm trying to implement
some simple EDSL in a typeful manner and having a problem with looking
up variable values.

I've got an Expression GADT, which admits variables. The problem is
with writing compute function which will lookup variable values in a
type-safe manner.

The exp. data type is like this

data Exp a where
   Const a :: Val a -> Exp a
   Var :: a -> String -> Exp a -- where the first comp. isn't
used,only for type info.
   

So, obviously, I have to perform lookups in some 'scope' to compute
the expression. By scope I mean the list of (name,value) pairs.

How do I represent the scope? Well, I haven't gone that far as to
encode statically the information about the type of every variable in
scope. Instead, I used existentials to hide their types and put'em all
in a list.

For that purpose I introduced pack/unpack.

-- value with dynamic type annotation
-- m here and below can be Val, Exp, etc.
-- to represent Val Int, Exp Int, etc.
data Type m = TInt (m Int)  | TString (m String) | TDouble (m Double)

class Typed a where
typ   :: m a -> Type m

instance Typed Int where typ x = TInt x
instance Typed String where typ x = TString x
instance Typed Double where typ x = TDouble x

data Opaque m = forall a. (Typed a) => Opaque (m a)

-- extract to an annotated representation
extract :: Opaque m -> Type m
extract (Opaque a) = typ a

How would you suggest, I write compute function?

My try was

compute :: Scope -> Exp t -> Val t
compute scope (Const x) = x -- trivial

compute scope (Var t name) = -- intereseting part
let opq = lookup name scope
val = case opq of
Nothing  -> error "not in scope"
Just opq -> extract opq
expType   = aux t
in case val `matches` expType of -- I'd like to make some 'matches'
func.
Nothing -> error "type error" -- which would either produce an
error
Just v  -> v -- or return the value, based on run-time tags

matches :: Typed m -> Typed m -> Maybe (m a)
  BUT of course this type is bad, there's no 'a' in the left side
matches (TInt x) (TInt _) = Just x
matches (TString x) (TString _) = Just x
matches (TDouble x) (TDouble _) = Just x
matches _ _ = Nothing

So, clearly the problem is in that Type m has no evidence of a, which
was its very purpose. Ok, so I made

data FType m a where
FInt :: m Int -> FType m Int
FString :: m String -> FType m String
FDouble :: m Double -> Aux m a

class Typed a where
typ   :: m a -> Type m -- as before
ftyp :: m a -> FType m a -- new one

and again obvious instance
instance Typed Int where ftyp x = FInt x
...

And of course, I'd like to get that information somehow
   extract2 (Opaque a) = ftyp a
I rewrote 'matches' accordingly but the problem is already in the type
of extract2

its type Opaque m -> (forall a. (Typed a) => m a)
is not good to ghc, less polymorphic than expected

So, in principle it must be doable, since opaque data retains its
dictionary, and by that I can get a dynamic tag, say FInt x, where x
is proved to be Int.

What would you suggest?

Thank you
___
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] directory tree?

2007-06-24 Thread Bryan O'Sullivan

Chad Scherrer wrote:


What got me thinking about this is I'd like to be able to do something
like this in just a couple lines of code:

gunzip -c ./2*/*.z

... and feed the result into a giant lazy ByteString.


Using my FileManip library, you'd do that like this.

import Codec.Compression.GZip
import qualified Data.ByteString.Lazy as B
import System.FilePath.Glob

foo :: IO B.ByteString
foo = namesMatching "*/*.gz" >>=
  fmap B.concat . mapM (fmap decompress . B.readFile)

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

http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] XmlSerializer.deserialize?

2007-06-24 Thread Andrea Vezzosi

As a side note i'd like to point out that introspectData has a problem with
constructors containing Strings because show (x::String) /= x:

data Foo = Foo { bar :: String } deriving (Typeable,Data)

introspectData (Foo "quux") --> [("bar","\"quux\"")]

Those extras \" don't look very nice in the xml.. (the output of
introspectData is also wrong in the article's example )
you should probably use a modified gshow:

gshow' :: Data a => a -> String
gshow' x = fromMaybe (gshow x) (cast x)

which is id for Strings.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Thomas Schilling
No, ffi is no extra package.  It would be helpful if you posted you  
configure output though.


BTW, please CC the list when replying.  The easiest way should be to  
use the "reply all" feature of your mail client.


Thanks,

Thomas


On 24 jun 2007, at 15.24, Jimmy Miller wrote:


That's all I know right now.  Is there another package I need to
install for the C FFI?  Also, is there any problem in Setup.hs saying
that sh was not found?

On 6/24/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:

That looks like a missing C macro definition.  It should probably
expand to either stdcall or ccall.  A bit more information would be
helpful.


On 24 jun 2007, at 13.11, Jimmy Miller wrote:

> I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows XP.
> runghc Setup.hs configure seems to work fine.  It gives messages  
about

> things missing, like sh, but there are no errors.
>
> When I run runghc Setup.hs build, I get the following error:
>
> [ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions
> ( Graphics/Renderin
> g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/OpenGL/GL/
> Extensions.o
> )
>
> Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
>parse error on input `CALLCONV'
>
> Does anyone know what might be going wrong?
>
> --
> http://www.spreadfirefox.com/?
> q=affiliates&id=153516&t=1"> rows="3" cols="40">Get Firefox!
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe





--
http://www.spreadfirefox.com/? 
q=affiliates&id=153516&t=1">
rows="3" cols="40">Get Firefox!


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


Re: [Haskell-cafe] Haskell version of ray tracer code ismuchslowerthan the original ML

2007-06-24 Thread Claus Reinke

also try replacing that (foldl' intersect') with (foldr (flip intersect'))!

OK, next question: Given that I'm using all the results from
intersect', why is the lazy version better than the strict one? Is ghc
managing to do some loop fusion?


haskell tends to prefer foldr where mls prefer foldl, be it for 
lazyness and short-circuiting operators, or because a tail-recursive

function with a lazy accumulator is only an efficient way to construct
inefficient expressions.

so, the very first thing i tend to look for when someone ports a 
program from ml to haskell are tail recursions with non-strict 
accumulators. even using foldl', when constructing pairs in the
accumulator, there's no guarantee that the pair components will 
be evaluated early even if the pairs themselves are forced. so

replacing foldl with foldr when porting from ml to haskell tends
to be a useful habit, unless there are good reasons for foldl.

however, things seem to be a little bit more involved in this 
example: intersect' forces the first component, and ignores
the second, never building nasty delayed combinations of old 
accumulator and list head in the new accumulator. but if you 
compare the outputs of -ddump-simpl, or if you export all 
definitions from main and compare the outputs of --show-iface, 
you'll find differences related to the the result of intersect': 
whether or not that result can be passed unboxed. 


   Constructed Product Result Analysis for Haskell (2000)
   http://citeseer.ist.psu.edu/baker-finch00constructed.html

i don't know the details, but in the foldr case, the result of
intersect' seems to be passed unboxed, in the foldl' case, it 
isn't. i'll leave it to the experts to explain whether that has to

be the case or whether it is an omission in the optimizer.

claus


using a recent ghc head instead of ghc-6.6.1 also seems to
make a drastic difference 


$ uname -a
CYGWIN_NT-5.1 cr3-lt 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6.1

$ gcc --version
gcc.exe (GCC) 3.4.2 (mingw-special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ghc --make Ray1.hs
[1 of 1] Compiling Main ( Ray1.hs, Ray1.o )
Linking Ray1.exe ...

$ time ./Ray1.exe >out

real0m55.705s
user0m0.015s
sys 0m0.031s

$ /cygdrive/c/fptools/ghc/ghc-6.7.20070613/bin/ghc --make Ray1.hs -o 
Ray1head.exe
[1 of 1] Compiling Main ( Ray1.hs, Ray1.o )
Linking Ray1head.exe ...

$ time ./Ray1head.exe >out.head

real0m24.989s
user0m0.031s
sys 0m0.015s

$ diff -q --binary out out.head

$


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


Re: [Haskell-cafe] Re: Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-24 Thread Claus Reinke

True enough, in a sense, a dynamically typed language is like a
statically typed language with only one type (probably several by
distinguishing function types) and many incomplete pattern matches. 
So, you can embed a dynamically typed language into a strongly typed
language without loosing static type checking. 


statically typed: typed at compile time
dynamically typed: typed at runtime

weakly typed: ..
strongly typed: everything is typed and type-checked

there are at least two problems with embedding strongly and 
dynamically typed languages into strongly and statically typed 
languages:


   - it assumes that there is a globally unique static stage, entirely
   separate from a globally unique dynamic stage
   - it assumes that there is a unique, unchanging (closed) world of types

static typing alone is too static to deal with dynamically evolving
types or flexible ideas such as runtime compilation or dynamic linking..

the solution is long-known as type Dynamic (a universal type in which
expressions are paired with type tags): projecting from a Dynamic to
the tag type (using a typecase) involves a 'static' type check prior to
stripping the type info away for a limited 'runtime', embedding
into a Dynamic involves creating a runtime type tag, to prepare for
situations that can't be handled statically.

if you have a strongly and otherwise statically typed language extended
with Dynamic/typecase, you can embed strongly and dynamically typed
languages into it. and you can try to reduce the number of Dynamic and
typecase uses to a minimum, giving you maximal phases of pre-checked
runtime without dynamic type representations or type checks. but there
are situations that need Dynamic/typecase.

if you have a strongly and dynamically typed language, you can embed
strongly and statically typed languages into it. by default, that means
you get more type-checks than necessary and type-errors later than 
you'd wish, but you still get them. eliminating runtime type information 
and runtime type-checks in a strongly and dynamically typed language 
is a question of optimisation, similar to deforestation.


if you have a strongly and statically typed language, there are situations
where you'll get stuck. extending the type system may get you beyond
some of these barriers, but only to the next set of problems. it is 
impressive just how far languages like haskell have managed to take

the idea of strong static typing, and it is worthwhile noting that many
people need nothing more most of the time. it is also worthwhile
recalling that the struggle involved has given us type systems that can
handle many of the problems that were thought to be dynamic in
nature within a static type system (such as generic programming). but
there always remains a small set of essential problems that exceed
what strong static typing can handle on its own.

adding Dynamic/typecase gives you the best of both worlds: the 
expressiveness of strongly and dynamically typed languages and 
the efficiency and early safety (between a typecase and a reembedding 
into Dynamic, there will be no runtime type-checks and no runtime 
type-errors) of strongly and statically typed languages. even better,

for the large number of programs that do not need dynamic types,
there'll be no sign of them - those programs work in the strongly
and statically typed subset of the language.

claus

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


Re: [Haskell-cafe] Constructing a datatype given just its constructor as a string?

2007-06-24 Thread Neil Mitchell

Hi


mkConstr :: String -> Constr
parseData :: (Data a) => String -> a


fromConstr, plus a bit of work to create the constructor.

http://www.haskell.org/hoogle/?q=fromConstr

Thanks

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


[Haskell-cafe] Constructing a datatype given just its constructor as a string?

2007-06-24 Thread Hugh Perkins

Trying to create a datatype/constructor given just its constructor as a
string, something like:

mkConstr :: String -> Constr
parseData :: (Data a) => String -> a

***without knowing in advance anything about the datatype apart from the
string contents***

So, not something like:

parseData "Just 3" :: [Maybe]

but simply:

parseData "Just 3"

(This is linked to the other post: the goal is to be able to deserialize xml
without needing to know in advance the data type we are deserializing)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] XmlSerializer.deserialize?

2007-06-24 Thread Hugh Perkins

Hi,

Trying to write a function to deserialize a haskell type from xml.

Ideally this wont need a third "DTD" file, ie it will work something like
XmlSerializer.Deserialize from C#:

deserializeXml :: Data(a) => String -> a
serializeXml :: Data(a) => a -> String

Writing serializeXml is pretty easy:

import Data.Generics

-- helper function from http://www.defmacro.org/ramblings/haskell-web.html
introspectData :: Data a => a -> [(String
,
String 
)]
introspectData a = zip

fields (gmapQ gshow a)
   where fields = constrFields $

toConstr a

-- function to create xml string from single-layer Haskell data type
serializeXml object = "<" ++

show 
(toConstr
object) ++ 

">" ++ 
  foldr 

(\(a,b) x  -> x ++

"<" ++ a ++ ">" ++ b ++ "") "" ( introspectData object )
  ++ 
"http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:.>
show 
(toConstr
object) ++ 

">"


... however cant figure out how to go the other way.

Usage of haxml or HXT to achieve this is ok, whatever it takes ;-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Thomas Schilling
That looks like a missing C macro definition.  It should probably  
expand to either stdcall or ccall.  A bit more information would be  
helpful.



On 24 jun 2007, at 13.11, Jimmy Miller wrote:


I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows XP.
runghc Setup.hs configure seems to work fine.  It gives messages about
things missing, like sh, but there are no errors.

When I run runghc Setup.hs build, I get the following error:

[ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions  
( Graphics/Renderin
g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/OpenGL/GL/ 
Extensions.o

)

Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
   parse error on input `CALLCONV'

Does anyone know what might be going wrong?

--
http://www.spreadfirefox.com/? 
q=affiliates&id=153516&t=1">
rows="3" cols="40">Get Firefox!
___
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: Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-24 Thread apfelmus
Neil Mitchell wrote:
>> 1) The programmer has to detail in some form the proof that his program
>> terminates. Arguably, he ought to do so anyway but he doesn't need to
>> write his proof in a way that can be checked by a dumb computer. Take
>> for example
>>
>>  minimum = head . sort
> 
> minimum [1..] gives _|_ non-termination
> 
> miniumum [1,_|_,3] gives _|_ while head [1,_|_,3] doesn't.
> 
> Termination is all a bit more complex once you get to laziness.

Oops, the example was not meant for termination but for the invariants.
I wanted to say that the code of minimum is likely to be shorter than a
computer-checkable proof that shows that its result is indeed the
smallest element from the list.

Regards,
apfelmus

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


Re: [Haskell-cafe] Re: Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-24 Thread Neil Mitchell

Hi


1) The programmer has to detail in some form the proof that his program
terminates. Arguably, he ought to do so anyway but he doesn't need to
write his proof in a way that can be checked by a dumb computer. Take
for example

 minimum = head . sort


minimum [1..] gives _|_ non-termination

miniumum [1,_|_,3] gives _|_ while head [1,_|_,3] doesn't.

Termination is all a bit more complex once you get to laziness.

Thanks

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


[Haskell-cafe] Installing HOpenGL

2007-06-24 Thread Jimmy Miller

I'm trying to install HOpenGL 2.1, with ghc 6.6 on Windows XP.
runghc Setup.hs configure seems to work fine.  It gives messages about
things missing, like sh, but there are no errors.

When I run runghc Setup.hs build, I get the following error:

[ 4 of 81] Compiling Graphics.Rendering.OpenGL.GL.Extensions ( Graphics/Renderin
g/OpenGL/GL/Extensions.hs, dist\build/Graphics/Rendering/OpenGL/GL/Extensions.o
)

Graphics/Rendering/OpenGL/GL/Extensions.hs:46:15:
   parse error on input `CALLCONV'

Does anyone know what might be going wrong?

--
http://www.spreadfirefox.com/?q=affiliates&id=153516&t=1";>Get Firefox!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-24 Thread apfelmus
Dave Bayer wrote:
> I've enjoyed the recent typing discussions here. On one hand, there's
> little difference between using dynamic typing, and writing incomplete
> patterns in a strongly typed language. On the other hand, how is an
> incomplete pattern any different from code that potentially divides by
> zero? One quickly gets into decidability issues, dependent types,
> Turing-complete type systems.

True enough, in a sense, a dynamically typed language is like a
statically typed language with only one type (probably several by
distinguishing function types) and many incomplete pattern matches. So,
you can embed a dynamically typed language into a strongly typed
language without loosing static type checking. However, the other way
round is impossible: virtually void of static type checking, the dynamic
language is incapable of embedding a strongly typed language without
loosing type safety. Thus, you still gain something with strong typing
even with incomplete pattern matches. In fact, the programmer has the
power to arrange things such that he gains extremely much.

What about throwing out incomplete patterns completely? Well, this is a
very mixed blessing. There are incomplete patterns and non-terminating
programs, both commonly denoted with _|_. As long as you allow
non-termination, you can't get rid of incomplete patterns. But enforcing
termination everywhere can be very limiting:

1) The programmer has to detail in some form the proof that his program
terminates. Arguably, he ought to do so anyway but he doesn't need to
write his proof in a way that can be checked by a dumb computer. Take
for example

 minimum = head . sort

Here, the theorem that this program proves is obvious from the proof
itself. But to make it checkable by a machine, I'm sure that further
type annotations are needed that don't add additional insight anymore.

2) There are programs that terminate but cannot be stated in a given
always-terminating language. Most likely, an interpreter for this
language is one of those programs.

Getting rid of incomplete patterns means to rule out terms that do not
fulfill a given invariant. Dependent types are a good way too that, but
again, you have issue 1). The proofs will only be tractable if it's
possible to concentrate on the interesting invariants and drop the
others. In the end, strongly normalizing languages and dependent types
are an active research area for exactly these problems.


In the end, I think that strong types is only one thing that makes
Haskell programs work after compilation. The other ones are higher-order
functions and *purity*. No type system can achieve what purity offers.


Regards,
apfelmus

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


Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-24 Thread Henning Thielemann

On Sat, 23 Jun 2007, David Roundy wrote:

> > I refuse to drink the Kool-Aid and recite precisely what I'm told a
> > type is in June, 2007; I'm hoping that types will evolve by the time
> > I die. For types to evolves, we need to step back a few feet and
> > think more loosely what a type really is.
>
> When talking about Haskell on Haskell mailing lists, it makes communication
> easier if you use Haskell terminology.  e.g. when you use the word type, if
> you mean the thing that is called a type in the Haskell language.

This means people cannot talk about future developments of type theory
here ...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parallel + exceptions

2007-06-24 Thread Donald Bruce Stewart
andrewcoppin:
> Bulat Ziganshin wrote:
> >Hello Andrew,
> >
> >  
> >definitive reading: "Tackling the awkward squad: monadic input/output,
> >concurrency, exceptions, and foreign-language calls in Haskell"
> >http://research.microsoft.com/Users/simonpj/papers/marktoberdorf/marktoberdorf.ps.gz
> >  
> 
> I've read it.
> 
> Is everything described in that paper actually implemented now? (And 
> implemented in exactly the same way as the paper says?)
> 
> >in my experience, exceptions are rarely required in Haskell program -
> >i use them only to roll out when IO problems occur.
> 
> Indeed. Somebody else mentioned Maybe; much cleaner, more intuitive 
> solution.
> 
> >OTOH, concurrency
> >is very handy in Haskell/GHC - it's easy to create threads and
> >communicate in reliable way, so it's a great tool to split algorithm
> >into subtasks. and GHC lightweight threads make it very cheap - you
> >may run thousands of threads. example program that uses one thread to
> >produce numbers and another to print them is less than 10 lines long
> >  
> 
> It's nice that you can have millions of threads if you want to do 
> something very "concurrent". What I tend to want is "parallel" - doing 
> stuff that *could* be done in a single thread, but I want it to go 
> faster using my big mighty multicore box. As I understand it, you have 
> to do something "special" to make that happen...?
> 
> While we're on the subject... has anybody ever looked at using muptiple 
> processors on *networked* machines? Haskell's very pure semantics would 
> seem quite well-suited to this...
> 

MPI/cluster stuff has also been done a fair bit, but in these days SMP
multicore machines are a hot topic. Start here:


http://haskell.org/haskellwiki/Applications_and_libraries/Concurrency_and_parallelism

P.S. An awful lot of your questions are previously answered on the wiki :-)
It's a good resource!

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