Re: [Haskell-cafe] Re: Library design question
On Fri, Sep 19, 2008 at 7:02 PM, Andre Nathan [EMAIL PROTECTED] wrote: On Fri, 2008-09-19 at 23:16 +0200, Daniel Fischer wrote: Yes. What's IO gotta do with it? I did it because of randomIO :( (or what about StateT (Graph a b) (State StdGen) ?). Now there's something I wouldn't have thought of... I changed the RandomGraph type to type RandomGraph a b = StateT (Graph a b) (State StdGen) () and randomFloat to randomDouble :: State StdGen Double randomDouble = State random and randomGraph to randomGraph :: StdGen - Int - Double - Graph Int Int randomGraph gen n p = evalState (execStateT create Graph.empty) gen where create = mapM_ (uncurry $ createVertex p) vls vls= zip [1..n] (repeat 42) However, when I try to create a graph with 1000 vertices I get a stack overflow, which didn't happen in the IO version. Any idea why that happens? I believe modify is lazy. Try replacing it with a stricter version, modify' f = do s - get put $! f s -- Dave Menendez [EMAIL PROTECTED] http://www.eyrie.org/~zednenem/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Iteratee-based IO
brian wrote: I want to use Parsec to parse NNTP data coming to me from a handle I get from connectTo. One unworkable approach I tried is to get a lazy String from the handle with hGetContents. It seems there is another approach, which is neither unsafe nor imperative. It relies neither on lazy IO nor on Handles. The input data can come from a file or from an embedded (e.g., chunk-encoded or encrypted) stream; the depth of embedding is arbitrary. The approach is naturally incremental. It permits IO interleaving without any unsafe operations. The approach is algebraic and declarative. The approach is the topic of the DEFUN08 talk in the morning of September 27. The code is already available http://okmij.org/ftp/Haskell/Iteratee/ The file http://okmij.org/ftp/Haskell/Iteratee/README.dr describes the other files in that directory. The running example is reading lines (terminated by CR, LF or CRLF) from a file descriptor and then from the chunk-encoded body. The main example illustrates multiplexing across two file descriptors and the full IO interleaving. The same line parser is used to process data from the file descriptor stream and from the embedded chunk-encoded stream, which is incrementally decoded. The whole code is Haskell98. It is not optimized at all and has no GHC-specific pragmas and options. The code has been used for the Wc program demonstrated yesterday. Perhaps the code answers the questions posed yesterday by Don. Hopefully one can see several composition modes for the iteratees and enumerators; enumerators are just iteratee transformers and compose as such. Incidentally, the operator == is flipped ==. Just like = (which is flipped =), it is like a `call-by-value application'. When a call-by-value language evaluates the application (f e), the argument e and all of its effects are executed first. Because of this analogy, I'm tempted to rename == into something like $. or .$ (or perhaps $, although the latter is taken). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] having fun with GADT's
I dont remember where i saw it, but i think someone had an example of a list whose type is the maximum element in the list. I've been trying to reproduce that with GADT's. data One = One data Two = Two data Three = Three data MaxList t where Elem1 :: MaxList One Elem2 :: MaxList Two ML1Cons1 :: MaxList One - MaxList One - MaxList One ML1Cons2 :: MaxList One - MaxList Two - MaxList Two ML2Cons1 :: MaxList Two - MaxList One - MaxList Two ML2Cons2 :: MaxList Two - MaxList Two - MaxList Two a = ML2Cons2 Elem2 $ ML2Cons1 Elem2 $ ML1Cons1 Elem1 $ Elem1 so one problem is the tedium of defining a cons for each possible combination. The other problem is that i cant define a usefull tail that makes any sense. mlTail :: MaxList Two - MaxList t mlTail (ML2Cons2 a b) = b mlTail (ML2Cons1 a b) = b this one doesn't work, and probably because there is nothing that i could do with the return value. mlTail :: MaxList Two - MaxList Two mlTail (ML2Cons2 a b) = b mlTail (ML2Cons1 a b) = b --wont compile because b is a MaxList One will only work for lists that only contain Two's, which is not what i want either. So is this somehow possible? Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Ropes
On Fri, Sep 19, 2008 at 23:18, Don Stewart [EMAIL PROTECTED] wrote: RafaelGCPP.Linux: Hi all, Is there any implementation of the rope data structure in Haskell? I couldn't find any on Hackage, and I am intending to implement it. There's no mature rope implementation. Can you write a bytestring-rope that outperforms lazy bytestrings please :) I'll give it a try, but cannot promise anything on the outperform part! :-) -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Ropes
I am doing the ICFPC07 task right now, to learn Haskell and tried to use the Sequence, but the final code is too damn slow (a few iterations per minute!). The DNA needs only 2 operations: head (or take) and concat. I am thinking in using ropes for the DNA and sequences for all the rest (patterns, templates and RNA). On Fri, Sep 19, 2008 at 23:15, Ryan Ingram [EMAIL PROTECTED] wrote: I think Data.Sequence uses fingertrees which are pretty fast. I used a handgrown rope-like structure for ICFPC07 but I wish I had known about Sequence; it would have likely just been better. -- ryan 2008/9/19 Rafael Gustavo da Cunha Pereira Pinto [EMAIL PROTECTED]: Hi all, Is there any implementation of the rope data structure in Haskell? I couldn't find any on Hackage, and I am intending to implement it. Regards, Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Ropes
Rafael Gustavo da Cunha Pereira Pinto wrote: I am doing the ICFPC07 task right now, to learn Haskell and tried to use the Sequence, but the final code is too damn slow (a few iterations per minute!). The DNA needs only 2 operations: head (or take) and concat. I am thinking in using ropes for the DNA and sequences for all the rest (patterns, templates and RNA). I have been told that you could pretty much literally implement the algorithms from the problem specification with Seq from Data.Sequence and achieve acceptable speed (IIRC ~ one minute for generating a whole picture). Are you sure that there is no unintentional bug in your implementation that slows things down? Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Library design question
Am Samstag, 20. September 2008 08:53 schrieb David Menendez: On Fri, Sep 19, 2008 at 7:02 PM, Andre Nathan [EMAIL PROTECTED] wrote: On Fri, 2008-09-19 at 23:16 +0200, Daniel Fischer wrote: Yes. What's IO gotta do with it? I did it because of randomIO :( (or what about StateT (Graph a b) (State StdGen) ?). Now there's something I wouldn't have thought of... I changed the RandomGraph type to type RandomGraph a b = StateT (Graph a b) (State StdGen) () and randomFloat to randomDouble :: State StdGen Double randomDouble = State random and randomGraph to randomGraph :: StdGen - Int - Double - Graph Int Int randomGraph gen n p = evalState (execStateT create Graph.empty) gen where create = mapM_ (uncurry $ createVertex p) vls vls= zip [1..n] (repeat 42) However, when I try to create a graph with 1000 vertices I get a stack overflow, which didn't happen in the IO version. Any idea why that happens? I believe modify is lazy. Try replacing it with a stricter version, modify' f = do s - get put $! f s Or try Control.Monad.State.Strict. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: having fun with GADT's
Anatoly Yakovenko aeyakovenko at gmail.com writes: I dont remember where i saw it, but i think someone had an example of a list whose type is the maximum element in the list. I've been trying to reproduce that with GADT's. data One = One data Two = Two data Three = Three data MaxList t where Elem1 :: MaxList One Elem2 :: MaxList Two ML1Cons1 :: MaxList One - MaxList One - MaxList One ML1Cons2 :: MaxList One - MaxList Two - MaxList Two ML2Cons1 :: MaxList Two - MaxList One - MaxList Two ML2Cons2 :: MaxList Two - MaxList Two - MaxList Two a = ML2Cons2 Elem2 $ ML2Cons1 Elem2 $ ML1Cons1 Elem1 $ Elem1 so one problem is the tedium of defining a cons for each possible combination. The other problem is that i cant define a usefull tail that makes any sense. mlTail :: MaxList Two - MaxList t mlTail (ML2Cons2 a b) = b mlTail (ML2Cons1 a b) = b this one doesn't work, and probably because there is nothing that i could do with the return value. Your problem in this example is that the t in MaxList t is universally quantified when it needs to be existentially quantified. The following definition encodes the existential quantification as a rank-2 type: mlTail :: MaxList n - (forall t. MaxList t - a) - a mlTail (ML1Cons1 h t) f = f t mlTail (ML1Cons2 h t) f = f t mlTail (ML2Cons1 h t) f = f t mlTail (ML2Cons2 h t) f = f t It works with the rest of your code unmodified. mlTail :: MaxList Two - MaxList Two mlTail (ML2Cons2 a b) = b mlTail (ML2Cons1 a b) = b --wont compile because b is a MaxList One will only work for lists that only contain Two's, which is not what i want either. So is this somehow possible? This example here suggests that you are happy merely with a (not necessarily tight) upper bound on the list elements. The following code solves your problem in this case, using only type unification and not fundeps or TFs: data Nat a where Z :: Nat a S :: Nat a - Nat (S a) data Z data S a n00 = Z n01 = S n00 n02 = S n01 n03 = S n02 n04 = S n03 data MaxList t where Nil :: MaxList a Cons :: Nat a - MaxList a - MaxList a a = Cons n02 $ Cons n02 $ Cons n01 $ Nil --- :t a gives forall a. MaxList (S (S a)) which tells you exactly --- what you want: elements are at least 2. mlTail :: forall t. MaxList t - MaxList t mlTail (Cons h t) = t --- unfortunately, you lose information here if the first --- element is larger than the rest. Reiner ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell Weekly News: Issue 86 - September 20, 2008
--- Haskell Weekly News http://sequence.complete.org/hwn/20080920 Issue 86 - September 20, 2008 --- Welcome to issue 86 of HWN, a newsletter covering developments in the [1]Haskell community. Lots of NEW stuff this week! A new generics library, new versions of Pandoc and darcs, a new website for xmonad, a new GADT/type family inference engine for GHC, a Haskell binding for Qt, and some new, astonishingly elegant ideas from Oleg. Also, here's hoping that everyone has a lot of fun at ICFP! Announcements GHC version control. Simon Peyton-Jones [2]sent out a revised proposal for GHC version control. darcs 2.0.3pre1. Eric Kow [3]announced the first pre-release of [4]darcs 2.0.3, featuring a few major bug fixes and a handful of interesting features. EMGM. Sean Leather [5]announced a release of [6]Extensible and Modular Generics for the Masses (EMGM), a library for generic programming in Haskell using type classes. Pandoc 1.0.0.1. John MacFarlane [7]announced the release of [8]pandoc 1.0.0.1, the swiss army knife of text markup formats. Iteratee-based IO. oleg [9]described a [10]safe, declarative approach to input processing which will be the subject of a talk at DEFUN08 on September 27. MetaHDBC paper. Mads Lindstroem [11]announced a [12]draft version of a paper about the [13]MetaHDBC library, which uses Template Haskell to do type-safe database access. Comments are welcomed, especially about the overall quality of the paper, whether it can be called scientific, and anything Mads could do to improve the paper. qtHaskell 1.1.2. David Harley [14]announced a second preview release of [15]qtHaskell, a set of Haskell bindings for Trolltech's Qt. Discussion Library design question. Andre Nathan [16]asked for advice on designing a simple graph library. The resulting discussion included an analysis of using the State monad versus a more functional approach. A round of golf. Creighton Hogg [17]learns about laziness by [18]making grown men cry. XML (HXML) parsing :: GHC 6.8.3 space leak from 2000. Lev Walkin [19]discovers a nice example of an obscure class of space leaks while writing some XML-processing code, prompting an in-depth analysis by Simon Marlow. Proofs and commercial code. Daryoush Mehrtash [20]asked about automated proof tools and techniques, and their uses in the real world. Blog noise [21]Haskell news from the [22]blogosphere. * Creighton Hogg: [23]Haskell Cafe or: How I learned to stop worrying love laziness. * Douglas M. Auclair (geophf): [24]Animal as RDR, part II. Doug continues his posts on RDR expert systems. * Ivan Lazar Miljenovic: [25]Getting Real World Haskell Down Under. * Douglas M. Auclair (geophf): [26]Animal: an RDR implementation study. Doug describes ripple-down rules expert systems, and illustrates the types needed to encode one in Haskell. * Mark Jason Dominus: [27]data Mu f = In (f (Mu f)). Mark writes about fixpoints of type constructors. * John Goerzen (CosmicRay): [28]Switched from KDE to xmonad. John has taken the plunge to xmonad and seems to like it so far! * Eric Kow (kowey): [29]darcs weekly news #4. Pre-release of darcs 2.0.3; darcs hacking sprint next month; code.haskell.org upgrades to darcs 2; and other news. * Mads Lindstroem: [30]MetaHDBC paper (draft). Mads's first paper ever, on using Template Haskell for type-safe database access. Comments welcome! * Braden Shepherdson: [31]xmonad-light 0.8 Released. * Manuel M T Chakravarty: [32]GHC HEAD just got a new inference engine for GADTs and type families.. * Magnus Therning: [33]Haskell and Time. Magnus describes the solution to a problem with Data.Time. * Dan Piponi (sigfpe): [34]Two Papers and a Presentation. * Xmonad: [35]New xmonad website launched. xmonad has a shiny new website! Quotes of the Week * Botje: GHC 11 will have shootout entries as primitives. * wjt: oh, i see what you're doing. ...no, i don't. *splode* * Benjamin Pierce: [on existential types] I have a term, and it has a type. So there. * bos: come on, real programmers use (((,) $) .) . (*) * quicksilver: #haskell : Sometimes we answer your question, sometimes we lay hideous traps which will devour your soul. It's a risk you take. * harrison: [on computing 100!] it is the same as factorial 99 * 100, big deal About the Haskell Weekly News New editions are posted to [36]the Haskell mailing list as well as to [37]the Haskell Sequence and [38]Planet Haskell. [39]RSS is also available, and headlines appear on [40]haskell.org. To help create new
[Haskell-cafe] OpenSPARC project applicant chosen
I am very pleased to announce that we have chosen Ben Lippmeier for the OpenSPARC project. Congratulations Ben! Ben will spend three months hacking on GHC to make it perform well on the latest multi-core OpenSPARC chips. I would also like to thank the other people who applied. The reviewers were very impressed by the number of strong applications. About the project - http://haskell.org/opensparc/ It is a joint project between Sun Microsystems and the Haskell.org community. Sun has provided the funding for Ben to work on this full time for three months and has donated a powerful SPARC server for him and the rest of us to use. Ben will be working with Roman Leshchinskiy as a mentor and Darryl Gove as an adviser. Roman works on Data Parallel Haskell at UNSW and Darryl is a senior staff engineer in the SPARC compiler team at Sun. If you want to follow the progress we will be using the existing ghc development mailing list: http://www.haskell.org/mailman/listinfo/cvs-ghc and a corner of the ghc development wiki: http://hackage.haskell.org/trac/ghc/wiki/OpenSPARC Duncan (project coordinator) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Library design question
On Sat, 2008-09-20 at 14:56 +0200, Daniel Fischer wrote: modify' f = do s - get put $! f s Or try Control.Monad.State.Strict. Control.Monad.State.Strict did it for me, but the strict modify didn't. I tried using modify' and also randomDouble = do g - get let (r, g') = random g put $! g' return r instead of randomDouble = State random Any hints on how I could find where else the program is being too lazy? Thanks, Andre ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hugs on the iphone
Hi, I finally got hugs to compile for the iPhone 2.x firmware ( pwnaged,obviously ). It was a matter of using the gcc compiler version distributed by apple in their iPhone SDK ( wich generates ARM code and suitable for cross-compiling C code in a mac ), autoconf 'configure' script tweaking and some system variables hacking here and there. So, now you ( and I ), people will be able to run your Haskell code directly on the iPhone using hugs ( hoping not to be the only one... ;-)) I'm in the process of submitting the package to one of those public repositories of iphone apps... you'll have notices soon. If someone can resist, and like to have cydia compatible packages, just drop me a note and I'll send them to you by mail. Greets, Alberto On Mon, Sep 15, 2008 at 6:01 PM, Miguel Mitrofanov [EMAIL PROTECTED]wrote: My iPhone (iPod Touch, actually) have 1.1.4 firmware, so there isn't any code signing involved. I've just configured and maked. On 15 Sep 2008, at 09:47, Alberto R. Galdo wrote: Cool! That's such a proof that it can be done... I had lots of problems trying to cross compile hugs from my mac to arm architecture ( seems that hugs codebase is not capable of cross compiling ) And when compiling directly on the iPhone, first there where problems with code signing, now with the configure script and C preprocessor sanity check... Any light on the topic from your experience? On 15/09/2008, at 7:24, Miguel Mitrofanov [EMAIL PROTECTED] wrote: Did that. http://migmit.vox.com/library/photo/6a00e398c5c26f000500fa9696d8c40002.html On 14 Sep 2008, at 14:17, Alberto R. Galdo wrote: Hi, is there any chance of having hugs compile for the iPhone? Cross-compiling? Compiling directly on the iPhone? Greets, Alberto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Library design question
Am Samstag, 20. September 2008 17:46 schrieb Andre Nathan: On Sat, 2008-09-20 at 14:56 +0200, Daniel Fischer wrote: modify' f = do s - get put $! f s Or try Control.Monad.State.Strict. Control.Monad.State.Strict did it for me, but the strict modify didn't. I tried using modify' and also randomDouble = do g - get let (r, g') = random g put $! g' return r instead of randomDouble = State random Any hints on how I could find where else the program is being too lazy? Profiling. Find out where your programme spends its time and what uses the memory. Add lots of {-# SCC #-} pragmas to get a more detailed picture. Thanks, Andre ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.
Hello Brandon and Haskell-cafe, (Sorry for the delayed reply...) These seem to be the relevant lines from configure of OpenGL package. checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking OpenGL/gl.h usability... no checking OpenGL/gl.h presence... no checking for OpenGL/gl.h... no checking GL/glu.h usability... yes checking GL/glu.h presence... yes checking for GL/glu.h... yes checking OpenGL/glu.h usability... no checking OpenGL/glu.h presence... no checking for OpenGL/glu.h... no That looks like to me that the gl.h and glu.h header files were found and are usable (in some cases). I am able to build and install OpenGL and GLUT packages for Haskell, but many errors occur as seen below during linking. I still can't seem to figure out what is causing these linker errors... Any other ideas? :/ Thank you. __ Donnie On Fri, Sep 12, 2008 at 12:48 AM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On 2008 Sep 12, at 0:24, Donnie Jones wrote: I am trying to test do some OpenGL / GLUT programming in Haskell, but I had linker issues testing the 'Hello World' OpenGL Haskell program. I believe the linker issues were caused because the Haskell GLUT package couldn't find the GLUT C libraries that were installed with Debian packages. I have tested that my OpenGL install does work with (...) checking for GLUT library... no You need to check config.log from the Haskell GLUT build to see why it couldn't find (or possibly couldn't link with) the GLUT library. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.
On 2008 Sep 20, at 12:57, Donnie Jones wrote: checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking OpenGL/gl.h usability... no checking OpenGL/gl.h presence... no checking for OpenGL/gl.h... no checking GL/glu.h usability... yes checking GL/glu.h presence... yes checking for GL/glu.h... yes checking OpenGL/glu.h usability... no checking OpenGL/glu.h presence... no checking for OpenGL/glu.h... no That looks like to me that the gl.h and glu.h header files were found and are usable (in some cases). I am able to build Yes, you have the header. But it says nothing about whether -lGLU was found, and that's where your problems are. Also, that's configure output, not config.log output (which has a transcript of the tests, not just the summary). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: having fun with GADT's
data One = One data Two = Two data Three = Three data MaxList t where Elem1 :: MaxList One Elem2 :: MaxList Two ML1Cons1 :: MaxList One - MaxList One - MaxList One ML1Cons2 :: MaxList One - MaxList Two - MaxList Two ML2Cons1 :: MaxList Two - MaxList One - MaxList Two ML2Cons2 :: MaxList Two - MaxList Two - MaxList Two a = ML2Cons2 Elem2 $ ML2Cons1 Elem2 $ ML1Cons1 Elem1 $ Elem1 so one problem is the tedium of defining a cons for each possible combination. The other problem is that i cant define a usefull tail that makes any sense. mlTail :: MaxList Two - MaxList t mlTail (ML2Cons2 a b) = b mlTail (ML2Cons1 a b) = b this one doesn't work, and probably because there is nothing that i could do with the return value. Your problem in this example is that the t in MaxList t is universally quantified when it needs to be existentially quantified. The following definition encodes the existential quantification as a rank-2 type: mlTail :: MaxList n - (forall t. MaxList t - a) - a mlTail (ML1Cons1 h t) f = f t mlTail (ML1Cons2 h t) f = f t mlTail (ML2Cons1 h t) f = f t mlTail (ML2Cons2 h t) f = f t It works with the rest of your code unmodified. how do i define (forall t. MaxList t - a)? It seems like i just pushed the problem somewhere else. mlTail :: MaxList Two - MaxList Two mlTail (ML2Cons2 a b) = b mlTail (ML2Cons1 a b) = b --wont compile because b is a MaxList One will only work for lists that only contain Two's, which is not what i want either. So is this somehow possible? This example here suggests that you are happy merely with a (not necessarily tight) upper bound on the list elements. The following code solves your problem in this case, using only type unification and not fundeps or TFs: data Nat a where Z :: Nat a S :: Nat a - Nat (S a) data Z data S a n00 = Z n01 = S n00 n02 = S n01 n03 = S n02 n04 = S n03 data MaxList t where Nil :: MaxList a Cons :: Nat a - MaxList a - MaxList a a = Cons n02 $ Cons n02 $ Cons n01 $ Nil --- :t a gives forall a. MaxList (S (S a)) which tells you exactly --- what you want: elements are at least 2. mlTail :: forall t. MaxList t - MaxList t mlTail (Cons h t) = t --- unfortunately, you lose information here if the first --- element is larger than the rest. Thanks, that's really cool. Is there a way to keep a tight upper bound on the list using this method? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.
Hello Brandon, On Sat, Sep 20, 2008 at 1:02 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On 2008 Sep 20, at 12:57, Donnie Jones wrote: checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking OpenGL/gl.h usability... no checking OpenGL/gl.h presence... no checking for OpenGL/gl.h... no checking GL/glu.h usability... yes checking GL/glu.h presence... yes checking for GL/glu.h... yes checking OpenGL/glu.h usability... no checking OpenGL/glu.h presence... no checking for OpenGL/glu.h... no That looks like to me that the gl.h and glu.h header files were found and are usable (in some cases). I am able to build Yes, you have the header. But it says nothing about whether -lGLU was found, and that's where your problems are. Also, that's configure output, not config.log output (which has a transcript of the tests, not just the summary). ### Relevant lines that include -lGL or -lGLU in config.log ### configure:4634: checking for GL library configure:4670: gcc -o conftest -g -O2conftest.c -lGL -lm 5 configure:4676: $? = 0 configure:4696: result: -lGL -lm configure:4773: checking for GLU library configure:4809: gcc -o conftest -g -O2conftest.c -lglu32 -lGL -lm 5 /usr/bin/ld: cannot find -lglu32 collect2: ld returned 1 exit status configure:4815: $? = 1 configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME Haskell OpenGL package | #define PACKAGE_TARNAME OpenGL | #define PACKAGE_VERSION 2.2.1 | #define PACKAGE_STRING Haskell OpenGL package 2.2.1 | #define PACKAGE_BUGREPORT [EMAIL PROTECTED] | /* end confdefs.h. */ | #include GL/glu.h | int | main () | { | gluNewQuadric() | ; | return 0; | } configure:4809: gcc -o conftest -g -O2conftest.c -lGLU -lGL -lm 5 configure:4815: $? = 0 configure:4835: result: -lGLU -lGL -lm ... fp_cv_check_GLU_lib='-lGLU -lGL -lm ' fp_cv_check_GL_lib='-lGL -lm ' ... GLU_LIBS=' -lGLU -lGL -lm ' ... GL_LIBS=' -lGL -lm ' ... #define GLU_LIBS -lGLU ,-lGL ,-lm It seems like the OpenGL and GLUT libraries are found (after -lglu32 fails, I am using Debian Linux). I am not sure what to try now. Thank you for the help. :) __ Donnie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: protocol-buffers-0.2.9 for Haskell is ready
Hello one and all, Amid much rejoicing, my Haskell version of protocol-buffer is now released (version 0.2.9). What is this for? What does it do? Why? Shorter answer: It generates Haskell data types that can be converted back and forth to lazy ByteStrings that interoperate with Google's generated code in C++/Java/python. It is a pure Haskell re-implementation of the Google code at http://code.Google.com/apis/protocolbuffers/docs/overview.html which is ...a language-neutral, platform-neutral, extensible way of serializing structured data for use in communications protocols, data storage, and more. Google's project produces C++, Java, and Python code. This one produces Haskell code. The release tarball (with 3 Haskell packages inside, see README in source) is at http://hackage.haskell.org/cgi-bin/hackage-scripts/package/protocol-buffers The darcs repository has moved to http://darcs.haskell.org/packages/protocol-buffers2/ You will also need a recent ghc compiler, the binary package and the utf8-string package from hackage.haskell.org (same site as mentioned above). The source compiles to 3 things: 1) the package protocol-buffers with the library API 2) the package protocol-buffers-descriptor with the descriptor.proto code 3) The 'hprotoc' executable which is a command line program similar to 'protoc'. The examples sub-directory in the code has the Haskell version of the addressbook.proto example and is compatible with Google's similar example code. The code generated from unittest.proto (and unittest_import.proto) includes messages TestAllTypes and TestAllExtensions which have been extensively tested by QuickCheck to ensure they can be wire encoded and decoded (see the tests sub-directory in the code). The user API, as exported by Text.ProtocolBuffers, allows for converting messages back and forth to the lazy ByteString type. And such messages can be merged, and the defaults accessed via the MessageAPI type class. The messages in Haskell as just regular data types and are thus immutable. Required types are simple record fields, optional types are Maybe, and repeated types are Seq (from Data.Sequence). Extensions are supported via Key data that allows access to the extension fields. Extensible messages contain an opaque ext'field entry of type ExtField that contains the map data structure to contain the extension field values. The User API allows for serializing messages as the usual series of fields. It also provides for a length prefix to be written to create delimited messages. It also provides to write a wire tag with any field number before the length and message data. This last form looks like a field on the wire, and there is a special api call to read back just the one message and its field number. This last API is similar to the one that is part of the C# API. No benchmarks have been run yet. Any suggestions? Unsupported for the moment is loading and storing unknown fields. It can be added sooner if someone has a use for this. Unsupported indefinitely is code generation for Services and Methods. I have yet to look into how this is presented in the other languages. The API to read a single message field, as mentioned above, might be extended to read any type instead of just messages. optional clever_quote { autrijus Perl: Easy things are easy, hard things are possible autrijus Haskell: Hard things are easy, the impossible just happened } Cheers! Chris Kuklewicz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: having fun with GADT's
On Sat, Sep 20, 2008 at 1:12 PM, Anatoly Yakovenko [EMAIL PROTECTED] wrote: Your problem in this example is that the t in MaxList t is universally quantified when it needs to be existentially quantified. The following definition encodes the existential quantification as a rank-2 type: mlTail :: MaxList n - (forall t. MaxList t - a) - a mlTail (ML1Cons1 h t) f = f t mlTail (ML1Cons2 h t) f = f t mlTail (ML2Cons1 h t) f = f t mlTail (ML2Cons2 h t) f = f t It works with the rest of your code unmodified. how do i define (forall t. MaxList t - a)? It seems like i just pushed the problem somewhere else. Since MaxList is a GADT, you can always look inside to specialize the parameter. In fact, with this particular definition, you just have to look at the outermost constructor. findMax :: MaxList n - Either (MaxList One) (MaxList Two) findMax [EMAIL PROTECTED] = Left l findMax [EMAIL PROTECTED] = Right l findMax l@(ML1Cons1 _ _) = Left l findMax l@(ML1Cons2 _ _) = Right l findMax l@(ML2Cons1 _ _) = Right l findMax l@(ML2Cons2 _ _) = Right l This example here suggests that you are happy merely with a (not necessarily tight) upper bound on the list elements. The following code solves your problem in this case, using only type unification and not fundeps or TFs: [...] Thanks, that's really cool. Is there a way to keep a tight upper bound on the list using this method? One way is to use a witnesses to prove that the head of the list is either the maximum element, or less than (or equal) to the maximum element. data MaxList n where Nil :: MaxList Z ConsMax :: LE n a - Nat a - MaxList n - MaxList a ConsLE :: LE a n - Nat a - MaxList n - MaxList n cons :: Nat a - MaxList b - (forall n. MaxList n - ans) - ans cons a as f = case cmp a (maximum as) of Left le - f (ConsLE le a as) Right le - f (ConsMax le a as) mlTail :: MaxList a - (forall b. MaxList b - ans) - ans mlTail (ConsMax _ _ as) f = f as mlTail (ConsLE _ _ as) f = f as There are at least three ways to define LE, which have different trade-offs in terms of usability and space efficiency. One way is to encode both numbers, data LE a b where ZLE :: Nat b - LE Z b SLE :: LE a b - LE (S a) (S b) cmp :: Nat a - Nat b - Either (LE a b) (LE b a) cmp Z b = Left (ZLE b) cmp a Z = Right (ZLE a) cmp (S a) (S b) = either (Left . SLE) (Right . SLE) (cmp a b) maximum :: MaxList n - Nat n maximum Nil = Z maximum (ConsMax _ n _) = n maximum (ConsLE le _ _) = greater le greater :: LE a b - Nat b greater (ZLE b) = b greater (SLE l) = S (greater l) lesser :: LE a b - Nat a lesser (ZLE b) = Z lesser (SLE l) = S (lesser l) Alternatively, you can encode the difference between a and b, data LE a b where Eq :: LE a a Lt :: LE a b - LE a (S b) cmp :: Nat a - Nat b - Either (LE a b) (LE b a) cmp Z Z = Left Eq cmp Z (S b) = Left (Lt (zle b)) cmp (S a) Z = Right (Lt (zle a)) cmp (S a) (S b) = either (Left . sle) (Right . sle) (cmp a b) zle :: Nat a - LE Z a zle Z = Eq zle (S n) = Lt (zle n) sle :: LE a b - LE (S a) (S b) sle Eq = Eq sle (Lt l) = Lt (sle l) -- Since only the types change, it should be safe to -- replace sle with unsafeCoerce. In that case, the -- final equation for cmp can just be --cmp (S a) (S b) = unsafeCoerce (cmp a b) maximum :: MaxList n - Nat n maximum Nil = Z maximum (ConsMax _ n _) = n maximum (ConsLE le a _) = greater le a greater :: LE a b - Nat a - Nat b greater Eq n = n greater (Lt l) n = S (greater l n) lesser :: LE a b - Nat b - Nat a lesser Eq n = n lesser (Lt l) (S n) = lesser l n -- Dave Menendez [EMAIL PROTECTED] http://www.eyrie.org/~zednenem/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] haskell shootout -- mandelbrot
Since this one's trivially parallizable, I took a crack at the mandelbrot test case. It was fairly easy to thread it on a per-line basis in Haskell without changing the original too much. It might be more efficient to break the work into larger chunks, but that would require some slightly more complicated changes so I didn't try that yet. Anyway, the code and the results are here. See README for details: http://www.thenewsh.com/~newsham/shootout/ Tim Newsham http://www.thenewsh.com/~newsham/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Ropes
I have been told that you could pretty much literally implement the algorithms from the problem specification with Seq from Data.Sequence and achieve acceptable speed (IIRC ~ one minute for generating a whole picture). Yes, it is straightforward to implement the algorithm when using sequences. Are you sure that there is no unintentional bug in your implementation that slows things down? The test cases on the problem definition all worked, but they touch very little of the code. I added some trace calls, but could not see any trouble. I also did some runs by hand and it seemed ok. If only Gödel was wrong... :-) -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] haskell shootout -- mandelbrot
a) have you submitted it to the shootout. no b) is it faster yes c) can you put it on the parallel shootout wiki, http://haskell.org/haskellwiki/Shootout/Parallel http://haskell.org/haskellwiki/Shootout/Parallel/Mandelbrot Tim Newsham http://www.thenewsh.com/~newsham/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OpenSPARC project applicant chosen
* Duncan Coutts [EMAIL PROTECTED] [2008-09-20 16:37:08+0100] If you want to follow the progress we will be using the existing ghc development mailing list: http://www.haskell.org/mailman/listinfo/cvs-ghc and a corner of the ghc development wiki: http://hackage.haskell.org/trac/ghc/wiki/OpenSPARC I hope Brent also will be publishing the news of the project in HWN. -- Roman I. Cheplyaka :: http://ro-che.info/ kzm: My program contains a bug. How ungrateful, after all I've done for it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] haskell shootout -- mandelbrot
newsham: a) have you submitted it to the shootout. no b) is it faster yes c) can you put it on the parallel shootout wiki, http://haskell.org/haskellwiki/Shootout/Parallel http://haskell.org/haskellwiki/Shootout/Parallel/Mandelbrot Nice, on quad core, the old entry, $ time ./Old 6400 /dev/null ./Old 6400 /dev/null 6.99s user 0.01s system 99% cpu 7.015 total And Tim's parallel entry, $ time ./A 6400 +RTS -N6 /dev/null ./A 6400 +RTS -N6 /dev/null 6.89s user 0.03s system 346% cpu 1.995 total Noice! -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OpenSPARC project applicant chosen
On Sat, 2008-09-20 at 23:50 +0300, Roman Cheplyaka wrote: * Duncan Coutts [EMAIL PROTECTED] [2008-09-20 16:37:08+0100] If you want to follow the progress we will be using the existing ghc development mailing list: http://www.haskell.org/mailman/listinfo/cvs-ghc and a corner of the ghc development wiki: http://hackage.haskell.org/trac/ghc/wiki/OpenSPARC I hope Brent also will be publishing the news of the project in HWN. I'm also hoping Ben might post updates to a blog, but I've not asked him yet. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Munging wiki articles with tagsoup
On 2008.09.09 19:49:49 +0100, Neil Mitchell [EMAIL PROTECTED] scribbled 2.3K characters: Hi Gwern, Sorry for not noticing this sooner, my haskell-cafe@ reading is somewhat behind right now! NP. I'm in no hurry; this TMR thing is an side project of mine, and I still haven't figured out how to get references/pandoc/citeproc-hs to work together, and I want to get them to work before I actually start uploading any converted articles. convertToHaskell (TagOpen pre atts) = TagOpen haskell atts convertToHaskell (TagClose pre) = TagClose haskell convertToHaskell x = x Direct pattern matching is much easier and simpler. That is very nice! Now the whole thing is like 5 lines of actual code. Once again, TagSoup wins. The escaping of ' is caused by renderTags, so instead call: renderTagsOptions (renderOptions{optEscape = (:[])}) Thanks. For no escaping of any characters, or more likely do something like , and conversions. See the docs: http://hackage.haskell.org/packages/archive/tagsoup/0.6/doc/html/Text-HTML-TagSoup-Render.html Well, I did look at that Haddock page, as well as the others. But honestly, just a bare line like 'renderTagsOptions :: RenderOptions - [Tag] - String' doesn't help me - it doesn't tell me that 'that's default behavior, but you can override it thusly'. Am I just barking up the wrong tree and should be writing a simple-minded search-and-replace sed script which replaces pre with haskell, /pre with /haskell...? Not necessarily. If you literally just want to replace haskell with pre then sed is probably the easy choice. However, its quite likely you'll want to make more fixes, and tagsoup gives you the flexibility to extend in that direction. Thanks Neil Hm hm. I see; the TagSoup way is more powerful in the long run. -- gwern blackjack NAVSVS Koancho Counter Merlin JICS 510 fuses JICC y signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Language.Haskell and strings
Hi, I'm using Language.Haskell.* and would like to know if it's possible to pretty-print big strings like this: into something like this: \ \\ \\ \\ \\ \\ \ to respect the limit on number of columns. Can you help me? Is it possible to do that? Thanks, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Updated formlets sample?
Hey Martin, On 19 sep 2008, at 04:14, Martin Huschenbett wrote: I found a blog post concerning formlets [1] in the web. Since looks very interesting I tried to compile the sample code with recent versions of HAppS and formlets from hackage. But this didn't work as the API of formlets has changed since this post. I tried to adopt the code to the new API but I was unable to finish this since there is a new monadic context I don't know to handle in the right way. So my question is, is there an updated version of this sample code in the web or has anybody tried to adopt it and can send me the results? Yes, I'm sorry for that. The API is still very immature and due to changes, that's also why it hasn't been officially announced yet. I've just put an updated example at http://hpaste.org/10568, hope that'll work for you. I guess we should build a small homepage / wikipage that always has an up-to-date example. -chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.
Hello Clifford, Thank you for the quick reply. I was able to get a test C program that draws a triangle with GLUT to work: gcc -lglut triangle.o -o triangle.exe However, when building the Haskell GLUT 'Hello World' it uses, -lGLU to link GLUT, but that does not work; however, from the config.log output configure seems to think that -lGL should work. Is there a way I can change the build to use -lglut? Maybe with configure I can specify that -lglut is the correct way to link the GLUT libraries? Thank you! __ Donnie On Sat, Sep 20, 2008 at 3:42 PM, Clifford Beshers [EMAIL PROTECTED] wrote: It works for me. I'm running Ubuntu Hardy with some packages built by us at SeeReason (see debs.seereason.com). It looks like ghc can't find your glut libraries (not the Haskell wrappers, but the real GLUT libs). Try 'ghc -v --make ' and look at the linking lines and see what GHC is specifying (mine shows a -lglut). Try compiling an example C program against GLUT and see if that works. My package list looks like this: [EMAIL PROTECTED]:~/haskell$ dpkg -l \*glut\* Desired=Unknown/Install/ Remove/Purge/Hold | Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name VersionDescription +++-==-==- un freeglut-dev none (no description available) ii freeglut3 2.4.0-6OpenGL Utility Toolkit ii freeglut3-dev 2.4.0-6OpenGL Utility Toolkit development files un glut-doc none (no description available) un glutg3 none (no description available) un glutg3-dev none (no description available) ii libghc6-glut-d 2.1.1.1-2+3see Haskell GLUT binding for GHC un libghc6-glut-d none (no description available) un libghc6-glut-p none (no description available) un libglutnone (no description available) un libglut-devnone (no description available) pn libglut3 none (no description available) un libglut3-dev none (no description available) On Sat, Sep 20, 2008 at 1:13 PM, Donnie Jones [EMAIL PROTECTED] wrote: Hello Brandon, On Sat, Sep 20, 2008 at 1:02 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On 2008 Sep 20, at 12:57, Donnie Jones wrote: checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking OpenGL/gl.h usability... no checking OpenGL/gl.h presence... no checking for OpenGL/gl.h... no checking GL/glu.h usability... yes checking GL/glu.h presence... yes checking for GL/glu.h... yes checking OpenGL/glu.h usability... no checking OpenGL/glu.h presence... no checking for OpenGL/glu.h... no That looks like to me that the gl.h and glu.h header files were found and are usable (in some cases). I am able to build Yes, you have the header. But it says nothing about whether -lGLU was found, and that's where your problems are. Also, that's configure output, not config.log output (which has a transcript of the tests, not just the summary). ### Relevant lines that include -lGL or -lGLU in config.log ### configure:4634: checking for GL library configure:4670: gcc -o conftest -g -O2conftest.c -lGL -lm 5 configure:4676: $? = 0 configure:4696: result: -lGL -lm configure:4773: checking for GLU library configure:4809: gcc -o conftest -g -O2conftest.c -lglu32 -lGL -lm 5 /usr/bin/ld: cannot find -lglu32 collect2: ld returned 1 exit status configure:4815: $? = 1 configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME Haskell OpenGL package | #define PACKAGE_TARNAME OpenGL | #define PACKAGE_VERSION 2.2.1 | #define PACKAGE_STRING Haskell OpenGL package 2.2.1 | #define PACKAGE_BUGREPORT [EMAIL PROTECTED] | /* end confdefs.h. */ | #include GL/glu.h | int | main () | { | gluNewQuadric() | ; | return 0; | } configure:4809: gcc -o conftest -g -O2conftest.c -lGLU -lGL -lm 5 configure:4815: $? = 0 configure:4835: result: -lGLU -lGL -lm ... fp_cv_check_GLU_lib='-lGLU -lGL -lm ' fp_cv_check_GL_lib='-lGL -lm ' ... GLU_LIBS=' -lGLU -lGL -lm ' ... GL_LIBS=' -lGL -lm ' ... #define GLU_LIBS -lGLU ,-lGL ,-lm It seems like the OpenGL and GLUT libraries are found (after -lglu32 fails, I am using Debian Linux). I am not sure what to try now. Thank you for the help. :) __ Donnie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
SOLVED. Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.
Hello, ghc -package GLUT -lglut Hello1.hs -o Hello1 --- works! :) I'm not sure why I must specify -package GLUT and -lglut but that prevents the linker errors. Also, shouldn't configure correctly figure out how to link the GLUT libraries? Can someone explain? Thank you. __ Donnie On Sat, Sep 20, 2008 at 9:47 PM, Donnie Jones [EMAIL PROTECTED] wrote: Hello Clifford, Thank you for the quick reply. I was able to get a test C program that draws a triangle with GLUT to work: gcc -lglut triangle.o -o triangle.exe However, when building the Haskell GLUT 'Hello World' it uses, -lGLU to link GLUT, but that does not work; however, from the config.log output configure seems to think that -lGL should work. Is there a way I can change the build to use -lglut? Maybe with configure I can specify that -lglut is the correct way to link the GLUT libraries? Thank you! __ Donnie On Sat, Sep 20, 2008 at 3:42 PM, Clifford Beshers [EMAIL PROTECTED] wrote: It works for me. I'm running Ubuntu Hardy with some packages built by us at SeeReason (see debs.seereason.com). It looks like ghc can't find your glut libraries (not the Haskell wrappers, but the real GLUT libs). Try 'ghc -v --make ' and look at the linking lines and see what GHC is specifying (mine shows a -lglut). Try compiling an example C program against GLUT and see if that works. My package list looks like this: [EMAIL PROTECTED]:~/haskell$ dpkg -l \*glut\* Desired=Unknown/Install/ Remove/Purge/Hold | Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name VersionDescription +++-==-==- un freeglut-dev none (no description available) ii freeglut3 2.4.0-6OpenGL Utility Toolkit ii freeglut3-dev 2.4.0-6OpenGL Utility Toolkit development files un glut-doc none (no description available) un glutg3 none (no description available) un glutg3-dev none (no description available) ii libghc6-glut-d 2.1.1.1-2+3see Haskell GLUT binding for GHC un libghc6-glut-d none (no description available) un libghc6-glut-p none (no description available) un libglutnone (no description available) un libglut-devnone (no description available) pn libglut3 none (no description available) un libglut3-dev none (no description available) On Sat, Sep 20, 2008 at 1:13 PM, Donnie Jones [EMAIL PROTECTED] wrote: Hello Brandon, On Sat, Sep 20, 2008 at 1:02 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On 2008 Sep 20, at 12:57, Donnie Jones wrote: checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking OpenGL/gl.h usability... no checking OpenGL/gl.h presence... no checking for OpenGL/gl.h... no checking GL/glu.h usability... yes checking GL/glu.h presence... yes checking for GL/glu.h... yes checking OpenGL/glu.h usability... no checking OpenGL/glu.h presence... no checking for OpenGL/glu.h... no That looks like to me that the gl.h and glu.h header files were found and are usable (in some cases). I am able to build Yes, you have the header. But it says nothing about whether -lGLU was found, and that's where your problems are. Also, that's configure output, not config.log output (which has a transcript of the tests, not just the summary). ### Relevant lines that include -lGL or -lGLU in config.log ### configure:4634: checking for GL library configure:4670: gcc -o conftest -g -O2conftest.c -lGL -lm 5 configure:4676: $? = 0 configure:4696: result: -lGL -lm configure:4773: checking for GLU library configure:4809: gcc -o conftest -g -O2conftest.c -lglu32 -lGL -lm 5 /usr/bin/ld: cannot find -lglu32 collect2: ld returned 1 exit status configure:4815: $? = 1 configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME Haskell OpenGL package | #define PACKAGE_TARNAME OpenGL | #define PACKAGE_VERSION 2.2.1 | #define PACKAGE_STRING Haskell OpenGL package 2.2.1 | #define PACKAGE_BUGREPORT [EMAIL PROTECTED] | /* end confdefs.h. */ | #include GL/glu.h | int | main () | { | gluNewQuadric() | ; | return 0; | } configure:4809: gcc -o conftest -g -O2conftest.c -lGLU -lGL -lm 5 configure:4815: $? = 0 configure:4835: result: -lGLU -lGL -lm ... fp_cv_check_GLU_lib='-lGLU -lGL -lm ' fp_cv_check_GL_lib='-lGL -lm ' ... GLU_LIBS=' -lGLU -lGL -lm ' ... GL_LIBS=' -lGL -lm ' ... #define GLU_LIBS -lGLU ,-lGL ,-lm It seems like the OpenGL and GLUT libraries are found (after -lglu32 fails, I am using Debian Linux). I am not sure what to try now. Thank you for the help. :) __ Donnie
Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.
On 2008 Sep 20, at 21:47, Donnie Jones wrote: However, when building the Haskell GLUT 'Hello World' it uses, -lGLU to link GLUT, but that does not work; however, from the config.log output configure seems to think that -lGL should work. Is there a way I can change the build to use -lglut? Maybe with configure I can specify that -lglut is the correct way to link the GLUT libraries? Actually config.log said -lGLU worked. If it's not present, maybe the simplest solution is to make a symlink. (It would only need to be present for compilation; ld will use the SONAME entry in the library to find the runtime name, so it'll correctly use libglut.so.) Fixing it at the level of the configure script is less than simple; you would need to modify configure.in and run autoreconf on it to produce a fixed configure (and you're in trouble if you have an older autotools than was used to create it originally). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: SOLVED. Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.
On 2008 Sep 20, at 22:10, Donnie Jones wrote: ghc -package GLUT -lglut Hello1.hs -o Hello1 --- works! :) I'm not sure why I must specify -package GLUT and -lglut but that prevents the linker errors. Also, shouldn't configure correctly figure out how to link the GLUT libraries? Can someone explain? You're overriding the information recorded by ghc-pkg (which is used if you use ghc --make). As for why configure doesn't work, I think you'd have to let someone who knows the HOpenGL build stuff look at your system. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Configure bug? Re: SOLVED. Re: [Haskell-cafe] Linker Errors For OpenGL / GLUT 'Hello World' Program.
Hello Brandon, Maybe this is a bug in the configure script of Haskell OpenGL or GLUT packages? Any suggestion from the package maintainers (or someone more familiar with these packages)? Thanks! :) __ Donnie On Sat, Sep 20, 2008 at 10:13 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On 2008 Sep 20, at 22:10, Donnie Jones wrote: ghc -package GLUT -lglut Hello1.hs -o Hello1 --- works! :) I'm not sure why I must specify -package GLUT and -lglut but that prevents the linker errors. Also, shouldn't configure correctly figure out how to link the GLUT libraries? Can someone explain? You're overriding the information recorded by ghc-pkg (which is used if you use ghc --make). As for why configure doesn't work, I think you'd have to let someone who knows the HOpenGL build stuff look at your system. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe