Re: [Haskell-cafe] Collada, FBX, XML schemas and Haskell?

2007-08-17 Thread Radosław Grzanka
Hello, 2007/8/16, Peter Verswyvelen [EMAIL PROTECTED]: I wanted to do some experiments with HOpenGL, and one of the things I tried is importing 3D models. So I searched for a library that could do that, but besides Frag, who uses the limited MD3 format, I did not find anything useful. Has

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-17 Thread Ketil Malde
On Thu, 2007-08-16 at 12:50 -0700, Kim-Ee Yeoh wrote: Aaron Denney wrote: On 2007-08-15, Pekka Karjalainen [EMAIL PROTECTED] wrote: A little style issue here on the side, if I may. You don't need to use (++) to join multiline string literals. text = If you want to have multiline

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-17 Thread Kim-Ee Yeoh
Lennart Augustsson wrote: On 8/16/07, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: 'Course not. The (++) function like all Haskell functions is only a /promise/ to do its job. What does assembling at compile time mean here: s = I will not write infinite loops ++ s But if the strings are all

[Haskell-cafe] Re: Diagnosing stack overflow

2007-08-17 Thread apfelmus
Justin Bailey wrote: -- Determines if the length of the strings in the list is longer than the given -- count. If not, amount the list falls short is returned. Otherwise, -- -1 indicates the prefix list is at least that long. If the count is zero and -- the list is empty or just null strings, -1

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-17 Thread Lennart Augustsson
It's very hard to tell if it's worth it or not. Concatenating constant strings will turn the string into WHNF, which might enable some other transformation. By having lots of little transformations that on their own look worthless you can make big improvements. I'd like to see as much static

[Haskell-cafe] Re: Hints for Euler Problem 11

2007-08-17 Thread Jon Fairbairn
Kim-Ee Yeoh [EMAIL PROTECTED] writes: Aaron Denney wrote: I find the first far more readable. The compiler should be able to assemble it all at compile time, right? 'Course not. The (++) function like all Haskell functions is only a /promise/ to do its job. I find this comment

Re: [Haskell-cafe] Re: Bathroom reading

2007-08-17 Thread Kim-Ee Yeoh
ok-4 wrote: Someone mentioned the Blow your mind page. One example there really caught my attention. 1234567 = (1357,246) foldr (\a ~(x,y) - (a:y,x)) ([],[]) I've known about lazy match since an early version of the Haskell report, but have never actually used it. Last night,

[Haskell-cafe] Compile-time v run-time

2007-08-17 Thread Jon Fairbairn
I wrote: the compile-time/run-time dichotomy is only relevant when a value depends on data only available at run-time. Something I've wanted to experiment with for a long time and never got round to is writing CAFs back to the load module at the end of a run (if they're small enough or took a

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-17 Thread L.Guo
Hi. My plan is just add some *unusable* data to make diagonal grid normally. Here this is. p011_input = input ++ (transpose input) ++ diagInput ++ diagInputT where diagInput = p011_toDiag input diagInputT = p011_toDiag . (map reverse) $ input input = [

Re: [Haskell-cafe] Compile-time v run-time

2007-08-17 Thread Kim-Ee Yeoh
If RAM was treated as an extension of non-volatile storage instead of the other way round, we'd already be there. Put another way, would suspending program to disk achieve the same results? Jon Fairbairn wrote: Something I've wanted to experiment with for a long time and never got round

[Haskell-cafe] So far, so good! Until... (Haskell 98 Report questions)

2007-08-17 Thread Ian Duncan
... I hit Chapter 3 and started reading about expressions. *If you are able to answer any of these questions, please send me an email. I am very lost and confused in this section, so even one answered question may help greatly.* I actually decided to sit down and figure out the Haskell 98

Re: [Haskell-cafe] So far, so good! Until... (Haskell 98 Report questions)

2007-08-17 Thread Christopher L Conway
Ian, This is all programming language parsing jargon. If the Wikipedia doesn't help (try http://en.wikipedia.org/wiki/Formal_grammar), I recommend the first few chapters of Aho, Sethi, Ullman's Compilers: Principles, Techniques, and Tools aka the dragon book, or any good book on compilers, e.g.,

Re: [Haskell-cafe] So far, so good! Until... (Haskell 98 Report questions)

2007-08-17 Thread Andy Gimblett
On Fri, Aug 17, 2007 at 04:50:02AM -0700, Ian Duncan wrote: So here's my list of questions so far: 1. What are nonterminals? 2. What are productions and substitutions? [snip] Sounds to me like you want a book on language design, grammars, parsing, etc. :-) There are many good ones out

[Haskell-cafe] Basic question....

2007-08-17 Thread rodrigo.bonifacio
Hi all. I want to create the following polymorphic type (EnvItem) that we can apply two functions (envKey and envValue). I tried the following: type Key = String data EnvItem a = EnvItem (Key, a) envKey :: EnvItem (Key, a) - String envKey EnvItem (key, value) = key envValue ::

Re: [Haskell-cafe] Basic question....

2007-08-17 Thread Brandon S. Allbery KF8NH
On Aug 17, 2007, at 9:11 , rodrigo.bonifacio wrote: envKey :: EnvItem (Key, a) - String envKey EnvItem (key, value) = key envValue :: EnvValue(Key, a) - a envValue EnvItem (key, value) = value But this is resulting in the error: [Constructor EnvItem must have exactly 1 argument in

Re: [Haskell-cafe] Basic question....

2007-08-17 Thread Janis Voigtlaender
- Ursprüngliche Nachricht - Von: rodrigo.bonifacio [EMAIL PROTECTED] Datum: Freitag, August 17, 2007 3:11 pm Betreff: [Haskell-cafe] Basic question Hi all. I want to create the following polymorphic type (EnvItem) that we can apply two functions (envKey and envValue). I tried

Re: [Haskell-cafe] Basic question....

2007-08-17 Thread Chaddaï Fouché
Not only does you lack some parens around your patterns, your function types are wrong : type Key = String data EnvItem a = EnvItem (Key, a) envKey :: EnvItem a - String envKey (EnvItem (key, value)) = key envValue :: EnvItem a - a envValue (EnvItem (key, value)) = value -- Jedaï

[Haskell-cafe] Re: I'm stuck in my thought experiment

2007-08-17 Thread Al Falloon
Levi Stephen wrote: Hi, Apologies for a long post that may not be totally clear. I was thinking through a problem and how the data might be represented in Haskell. I'm now stuck and frustrated. Now, I'm not even sure whether I'm on the right track (I might still be thinking too OO).

Re: [Haskell-cafe] Re: Basic question....

2007-08-17 Thread Chaddaï Fouché
17 Aug 2007 14:44:28 +0100, Jon Fairbairn [EMAIL PROTECTED]: Why not data EnvItem a = EnvItem {key:: Key, value:: a} It's the real solution, but I feel it was worthwhile to underscore the other mistakes (often encountered by the newbies) in types and parameters. -- Jedaï

Re: [Haskell-cafe] defining last using foldr

2007-08-17 Thread Kurt Hutchinson
On 8/16/07, ok [EMAIL PROTECTED] wrote: We're going to have to keep track of whether we have a last element or not. The obvious candidate for this is Maybe x. Initially there is no element, Nothing. f x Empty = Just x f x (Just y) = Just y This picks up a new value (x) when there

Re: [Haskell-cafe] Looking at program execution

2007-08-17 Thread Thomas Hartman
[EMAIL PROTECTED]:~cat test.hs import Debug.Trace foo = foldl (\first second - (trace ( first: ++ ( show first) ) first) + (trace ( second: ++ (show second) ) second) ) 0 [1,2,3] bar = foldl (+) traceIt x = trace (\nTraceIt:\n++show x++\n) x [EMAIL PROTECTED]:~ghc -e foo test.hs first:

[Haskell-cafe] Very fast searching of byte strings

2007-08-17 Thread ChrisK
Post the the library mailing list at [1] is the Boyer-Moore algorithm implemented for strict and lazy bytestrings (and combinations thereof). It finds all the overlapping instances of the pattern inside the target. I have performance tuned it. But the performance for searching a strict

Re: [Haskell-cafe] Diagnosing stack overflow

2007-08-17 Thread Justin Bailey
On 8/16/07, Matthew Brecknell [EMAIL PROTECTED] wrote: However, it's possible that your use of this function is forcing evaluation of a deeply-nested thunk you've created somewhere else (as print does in the foldl example). Thank you for the detailed and helpful reply. I was led to this

Re: [Haskell-cafe] Re: Diagnosing stack overflow

2007-08-17 Thread Justin Bailey
On 8/17/07, apfelmus [EMAIL PROTECTED] wrote: Extracting the head and tail of ss with a let statement could lead to a huge unevaluated expression like rest = tail (tail (tail (...))) Even though they are probably forced, would breaking the head and tail apart via pattern-matching or a

Re: [Haskell-cafe] Looking at program execution

2007-08-17 Thread Thomas Hartman
or actually just... [EMAIL PROTECTED]:~cat test.hs import Debug.Trace foo = foldl (\first second - trace ( ( show first) ++ (+) ++ (show second ) ) ( first + second) ) 0 [1,2,3] [EMAIL PROTECTED]:~ghc -e foo test.hs 0+1 1+2 3+3 6 [EMAIL PROTECTED]:~ is probably better Thomas Hartman

Re: [Haskell-cafe] Basic question....

2007-08-17 Thread Brent Yorgey
On 8/17/07, rodrigo.bonifacio [EMAIL PROTECTED] wrote: Hi all. I want to create the following polymorphic type (EnvItem) that we can apply two functions (envKey and envValue). I tried the following: type Key = String data EnvItem a = EnvItem (Key, a) envKey :: EnvItem (Key, a) -

[Haskell-cafe] Re: Diagnosing stack overflow

2007-08-17 Thread apfelmus
Justin Bailey wrote: apfelmus wrote: Extracting the head and tail of ss with a let statement could lead to a huge unevaluated expression like rest = tail (tail (tail (...))) Even though they are probably forced, would breaking the head and tail apart via pattern-matching or a case

Re: [Haskell-cafe] Basic question....

2007-08-17 Thread Bryan Burgers
On 8/17/07, rodrigo.bonifacio [EMAIL PROTECTED] wrote: Hi all. I want to create the following polymorphic type (EnvItem) that we can apply two functions (envKey and envValue). I tried the following: type Key = String data EnvItem a = EnvItem (Key, a) envKey :: EnvItem (Key, a) -

[Haskell-cafe] trouble building regex-base 0.91 on ghc 6.7

2007-08-17 Thread Thomas Hartman
I'm trying to build the latest regex base, which is required for the other regex packages under ghc 6.7 It complains that it can't find Data.Sequence, because it's in a hidden module containers. I added containers to the cabal depends as can be seen in the grep below. And containers isn't

Re: [Haskell-cafe] trouble building regex-base 0.91 on ghc 6.7

2007-08-17 Thread Stefan O'Rear
On Fri, Aug 17, 2007 at 02:40:33PM -0400, Thomas Hartman wrote: I'm trying to build the latest regex base, which is required for the other regex packages under ghc 6.7 It complains that it can't find Data.Sequence, because it's in a hidden module containers. I added containers to the cabal

[Haskell-cafe] Remember the future

2007-08-17 Thread Andrew Coppin
I've seen comments in various places that monads allow you to borrow things from the future. That sounds completely absurd to me... can anybody explain? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] trouble building regex-base 0.91 on ghc 6.7

2007-08-17 Thread Thomas Hartman
thanks stefan, I did remember that discussion (actually also an answer to a question I asked.) I got from that that previous help that I had to edit the cabal file. The problem here, as you say, is that I had not re-run runghc Setup.hs configure. thanks, thomas. Stefan O'Rear [EMAIL

[Haskell-cafe] trouble compiling import GHC.Prim(MutableByteArray#, ..... (building regex-tdfa from darcs) -- what's that # sign doing?

2007-08-17 Thread Thomas Hartman
trying to compile regex-tdfa, I ran into another issue. (earlier I had a cabal problem but that's resolved.) there's a line that won't compile, neither for ghc 6.6.1 nor 6.7 import GHC.Prim(MutableByteArray#,RealWorld,Int#,sizeofMutableByteArray#,unsafeCoerce#) so the fresh darcs regex tdfa

Re: [Haskell-cafe] GHC linking problems

2007-08-17 Thread SevenThunders
Did I find a bug cabal? I have attempted to fix the problem Main.c:(.text+0x22): undefined reference to `__stginit_ZCMain' by compiling my Haskell library using the flag -no-hs-main. One would think that this would make sense if the library is to be used by an external C program. However I

Re: [Haskell-cafe] trouble compiling import GHC.Prim(MutableByteArray#, ..... (building regex-tdfa from darcs) -- what's that # sign doing?

2007-08-17 Thread Stefan O'Rear
On Fri, Aug 17, 2007 at 04:27:29PM -0400, Thomas Hartman wrote: trying to compile regex-tdfa, I ran into another issue. (earlier I had a cabal problem but that's resolved.) there's a line that won't compile, neither for ghc 6.6.1 nor 6.7 import

[Haskell-cafe] Re: Diagnosing stack overflow

2007-08-17 Thread Joe Buehler
Matthew Brecknell wrote: The key point of the example is that foldl itself doesn't need any of the intermediate values of the accumulator, so these just build up into a deeply-nested unevaluated thunk. When print finally demands an integer, the run-time pushes a stack frame for each level of

Re: [Haskell-cafe] Remember the future

2007-08-17 Thread Andrew Coppin
Gwern Branwen wrote: On 0, Andrew Coppin [EMAIL PROTECTED] scribbled: I've seen comments in various places that monads allow you to borrow things from the future. That sounds completely absurd to me... can anybody explain? Take a look at issue 6 of The Monad Reader; search for time

Re: [Haskell-cafe] Remember the future

2007-08-17 Thread Dan Piponi
On 8/17/07, Andrew Coppin [EMAIL PROTECTED] wrote: I've seen comments in various places that monads allow you to borrow things from the future. That sounds completely absurd to me... can anybody explain? Suppose you buy into the notion that monads sequence actions. Then consider the following

Re: [Haskell-cafe] Remember the future

2007-08-17 Thread Dan Piponi
On 8/17/07, Dan Piponi [EMAIL PROTECTED] wrote: On 8/17/07, Andrew Coppin [EMAIL PROTECTED] wrote: That sounds completely absurd to me... can anybody explain? Except...you can switch on ghc's special time travel features... On reflection I decided my example isn't very convincing. For one

Re: [Haskell-cafe] Re: Diagnosing stack overflow

2007-08-17 Thread Bryan O'Sullivan
Joe Buehler wrote: What is the point in building this huge thunk if it can't be evaluated without a stack overflow? It's not that there's a point to it, it's just the behaviour of foldl. Hence you shouldn't be using foldl. GHC's strictness analyser can sometimes save you from yourself if

[Haskell-cafe] What to do about an absent package maintainer?

2007-08-17 Thread Adam Langley
The HsOpenSSL package[1] is good work, but the author doesn't respond to email(*). I've a bunch of darcs patches to add tests, DSA support and fast Integer - BIGNUM functions. Can I use my Hackage account to upload version 0.2 if someone else uploaded 0.1? It is reasonable? I'm guessing that this

Re: [Haskell-cafe] defining last using foldr

2007-08-17 Thread Chaddaï Fouché
For a really good article to see how foldr is in fact very powerful and how you can make it do some funny tricks, see the Monad.Reader 6th issue : http://www.haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf I'll point out that you can write a lazy dropWhile with foldr in the style of the first

Re: [Haskell-cafe] defining last using foldr

2007-08-17 Thread Chaddaï Fouché
2007/8/18, Chaddaï Fouché [EMAIL PROTECTED]: For a really good article to see how foldr is in fact very powerful and how you can make it do some funny tricks, see the Monad.Reader 6th issue : http://www.haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf I just saw this was already linked in

Re: [Haskell-cafe] monte carlo trouble

2007-08-17 Thread Paul Johnson
I finally decided to actually solve the problem, and I'm sorry to say I was on the wrong track. ListT won't do it on its own: you actually need a custom monad that does the random pick in the bind operation. Attached are a module to solve the problem and a Main module that tests it. I hope

Re: [Haskell-cafe] Remember the future

2007-08-17 Thread jerzy . karczmarczuk
Andrew Coppin writes: I've seen comments in various places that monads allow you to borrow things from the future. That sounds completely absurd to me... can anybody explain? Actually, borrowing from the future - in an interpretation which is close to my own interests - doesn't need

Re: [Haskell-cafe] Remember the future

2007-08-17 Thread Paul Johnson
[EMAIL PROTECTED] wrote: Andrew Coppin writes: I've seen comments in various places that monads allow you to borrow things from the future. That sounds completely absurd to me... can anybody explain? Actually, borrowing from the future - in an interpretation which is close to my own

Re: [Haskell-cafe] trouble compiling import GHC.Prim(MutableByteArray#, ..... (building regex-tdfa from darcs) -- what's that # sign doing?

2007-08-17 Thread Thomas Hartman
Thanks Stefan. I got regex tdfa to compile on 6.7. FWIW, here's a patch, generated with darcs whatsnew against a fresh unzip of regex tdfa 0.92 I didn't patch against the darcs head because this uses a language progma in {-# options #-} in some file*, which ghc 6.7 didn't know what to do with,

Re: [Haskell-cafe] trouble compiling import GHC.Prim(MutableByteArray#, ..... (building regex-tdfa from darcs) -- what's that # sign doing?

2007-08-17 Thread Stefan O'Rear
On Fri, Aug 17, 2007 at 08:13:55PM -0400, Thomas Hartman wrote: Thanks Stefan. I got regex tdfa to compile on 6.7. FWIW, here's a patch, generated with darcs whatsnew against a fresh unzip of regex tdfa 0.92 I didn't patch against the darcs head because this uses a language progma in {-#

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-17 Thread Lennart Augustsson
On 8/17/07, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: Lennart Augustsson wrote: And as a previous poster showed, ghc does concatenate strings. And Haskell (as in the current language definition) does not. I was talking about Haskell. Haskell says nothing about compile time or run time in

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-17 Thread Tim Chevalier
On 8/17/07, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: Incidentally, GHC's type checker is Turing complete. You already have as much static evaluation as is practically possible. You already knew that. I don't see how the first statement implies the second. Cheers, Tim -- Tim Chevalier *

Re: [Haskell-cafe] Re: Bathroom reading

2007-08-17 Thread Albert Y. C. Lai
Dan Weston wrote: I hate to be a party pooper, but isn't this just: f = foldr (\a z - (a:snd z,fst z)) ([],[]) This takes less time to grok and takes no longer to run. For each type with exported constructors, one can always write deconstructors for it, if not already found in libraries.