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 inp

[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

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 possib

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 t

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 o

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

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

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, rege

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.

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'

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 Schi

[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. Update

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

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

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

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

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 downl

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 installe

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: Lib

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-o

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 i

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 x

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 k

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,

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 stati

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://ww

[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

[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 eas

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 wor

[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

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 mi

[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.E

[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 divi

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

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 > >