[Haskell-cafe] OpenGL: No instance for Random GLfloat

2012-05-02 Thread Mark Spezzano
Hi Haskellers, I'm trying to generate a random vertex in OpenGL as follows. genPosition :: IO (Vertex3 GLfloat) genPosition = do x - getStdRandom $ randomR (-1.6,1.6) y - getStdRandom $ randomR (-1.0,1.0) return (Vertex3 x y (-1))

Re: [Haskell-cafe] OpenGL: No instance for Random GLfloat

2012-05-02 Thread Mark Spezzano
a newtype wrapper for CFloat, which has a Random instance, I would do: {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} deriving instance Random GLFloat On Wed, May 2, 2012 at 6:29 PM, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi Haskellers, I'm

[Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread Mark Spezzano
Hi, Can someone please give me a _lucid_ and _simple_ explanation of exactly how continuations can be used in Haskell? I've already had a look at most of the tutorials and explanations on the web, but I'm still confused. Continuations and CPS have me baffled. (I have most of the Haskell

Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread Mark Spezzano
Hi Heinrich, I'm really looking to use the Cont monad itself--but the link you gave me is also helpful, so thank you. If anyone else has words of wisdom to add to this thread please feel free to pitch in. Thanks, Mark On 01/10/2011, at 5:08 PM, Heinrich Apfelmus wrote: Mark Spezzano

[Haskell-cafe] Array and Ix for custom Graph ADT

2011-08-13 Thread Mark Spezzano
datatypes--enumerations in other words) How can I index the Array with an instance of a Node. I think I need to make Node an instance of Ix somehow?? Is this a sensible approach? Sample code of the instance declaration for Ix would be helpful. Thanks Mark Spezzano

Re: [Haskell-cafe] Array and Ix for custom Graph ADT

2011-08-13 Thread Mark Spezzano
approach? Sample code of the instance declaration for Ix would be helpful. Thanks Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Array and Ix for custom Graph ADT

2011-08-13 Thread Mark Spezzano
Solved it with your help :) Thanks for your assistance! Mark Spezzano On 14/08/2011, at 8:29 AM, Daniel Fischer wrote: On Sunday 14 August 2011, 00:41:33, Mark Spezzano wrote: Hi Antoine, The first Int field is a unique index, beginning at 1 and increasing by 1 for each unique Node

Re: [Haskell-cafe] Fractional Part

2011-08-02 Thread Mark Spezzano
Hi Ata, You could write the following decimalPart :: Float - Integer decimalPart f = read (tail (tail (show (f :: Integer This basically says convert f into a String using the show function, and then get the tail of that String twice to get rid of the leading zero and the decimal point

[Haskell-cafe] More QuickCheck Questions

2011-07-25 Thread Mark Spezzano
be useful. Also what does shrink do? Example code of these would be tremendously helpful understanding these concepts. Thanks in advance, Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

[Haskell-cafe] QuickCheck Questions

2011-07-24 Thread Mark Spezzano
Hi all, I would appreciate it if someone can point me in the right direction with the following problem. I'm deliberately implementing a naive Queues packages that uses finite lists as the underlying representation. I've already read through Hughes' paper and the article in The Fun of

Re: [Haskell-cafe] QuickCheck Questions

2011-07-24 Thread Mark Spezzano
(specifically negative number) Thanks Mark On 25/07/2011, at 4:44 AM, Kevin Quick wrote: On Sun, 24 Jul 2011 07:30:56 -0700, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi all, I would appreciate it if someone can point me in the right direction with the following problem. I'm

[Haskell-cafe] Lambda Calculus: Bound and Free formal definitions

2010-12-29 Thread Mark Spezzano
and E2 showing exactly why. Personally I think that there's an error in the book. You can see the full text on Google Books (page 84) Thanks for reading! Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

Re: [Haskell-cafe] Lambda Calculus: Bound and Free formal definitions

2010-12-29 Thread Mark Spezzano
those two definitions appear identical. I could be missing something - I haven't read that book. Antoine On Wed, Dec 29, 2010 at 9:05 PM, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi, Presently I am going through AJT Davie's text An Introduction to Functional Programming Systems

Re: [Haskell-cafe] Lambda Calculus: Bound and Free formal definitions

2010-12-29 Thread Mark Spezzano
/somehow)? Thanks, Mark On 30/12/2010, at 1:52 PM, Mark Spezzano wrote: Duh, Sorry. Yes, there was a typo the second one should read If E is a combination E1 E2 then X is bound in E if and only if X is bound in E1 or is bound in E2. Apologies for that oversight! Mark On 30/12

[Haskell-cafe] HUnit Control.Exception assertFailure?

2010-11-15 Thread Mark Spezzano
absolutely nothing. (i.e. the expected failure was caught) 3. If the error is uncaught (in step 2; for whatever reason) then call assertFailure somemsg and my _test_ code should fail since the error it was expecting to occur didn't happen. Thanks, Mark Spezzano

Re: [Haskell-cafe] Combining wl-pprint and ByteString?

2010-11-09 Thread Mark Spezzano
to go, but can they be combined with the Doc type from the ansi-wl-pprint library? Mark On 09/11/2010, at 5:37 PM, Ivan Lazar Miljenovic wrote: On 9 November 2010 17:53, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi all, I want to do the following tasks in this order: 1. Read text

Re: [Haskell-cafe] Error installing hp2any-graph on Snow Leopard

2010-11-09 Thread Mark Spezzano
, at 10:24 PM, John Lato wrote: From: Mark Spezzano mark.spezz...@chariot.net.au Hi, I get the following error when doing a 'cabal install hp2any-graph' (the profiling tool) Does anyone know why? (I'm running Snow Leopard and I've tried using other flags suggested...but with no success

[Haskell-cafe] Error installing hp2any-graph on Snow Leopard

2010-11-08 Thread Mark Spezzano
Hi, I get the following error when doing a 'cabal install hp2any-graph' (the profiling tool) Does anyone know why? (I'm running Snow Leopard and I've tried using other flags suggested...but with no success). GLUT is already installed via MacPorts and via cabal. Resolving dependencies...

Re: [Haskell-cafe] Error installing hp2any-graph on Snow Leopard

2010-11-08 Thread Mark Spezzano
Hi Ivan, I don't think that these flags work with MacPorts--only with cabal. Mark On 08/11/2010, at 7:48 PM, Ivan Lazar Miljenovic wrote: On 8 November 2010 20:14, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi, I get the following error when doing a 'cabal install hp2any-graph

[Haskell-cafe] Combining wl-pprint and ByteString?

2010-11-08 Thread Mark Spezzano
. Cheers, Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Monads and Functions sequence and sequence_

2010-10-29 Thread Mark Spezzano
depending on the types of the Monads that they are processing. Is this correct? Some concrete examples would be really helpful. Even references to some research papers that explain the rationale behind these (and all the other..?) monad functions would be great. Thanks in advance, Mark Spezzano

Re: [Haskell-cafe] Re: Monads and Functions sequence and sequence_

2010-10-29 Thread Mark Spezzano
. If it's a sequence_ [putStrLn hello, putStrLn goodbye] then this prints out hello and goodbye on separate lines. It seems to work differently for different types. Mark On 30/10/2010, at 3:42 PM, Bardur Arantsson wrote: On 2010-10-30 07:07, Mark Spezzano wrote: Hi, Can somebody please

[Haskell-cafe] Compiling and installing glib and gtk+ on Snow Leopard

2010-10-23 Thread Mark Spezzano
Hi, I'm trying to install the Leksah IDE and I've run into the problem that it requires glib and gtk+. Whenever I type 'configure' for glib-2.26.0 everything goes fine. But when I type 'make' it goes through necessary actions and then suddenly stops halfway through stating the following

Re: [Haskell-cafe] Correct way to record state in OpenGL?

2010-04-08 Thread Mark Spezzano
: get foo write foo $= baz On 4 April 2010 11:03, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi What is the correct way to record custom state when using OpenGL? By this, I refer to, say, properties of a square--say it's x,y coordinates as it moves across the screen

Re: [Haskell-cafe] Correct way to record state in OpenGL?

2010-04-08 Thread Mark Spezzano
Maybe I should ask: If I have many state variables encapsulated in one IO (StateVar DemoState) how do I go about referencing and updating _one_ without having to enumerate all of them? What is the syntax? Mark On 09/04/2010, at 12:13 AM, Mark Spezzano wrote: I sort of understand what people

[Haskell-cafe] Correct way to record state in OpenGL?

2010-04-04 Thread Mark Spezzano
. Thanks in advance, Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Using ShowS or Difference Lists

2010-02-06 Thread Mark Spezzano
Hi, Just wondering whether I can use ShowS or tupling or Difference Lists to speed up the following code? It's basic text processing. It takes in a list of Lines where each Line is a list of Words and intersperses between them then concatenates them into a longer String. Note that there is

[Haskell-cafe] Category Theory woes

2010-02-02 Thread Mark Spezzano
on Discrete maths or Algebra or Set Theory that deal more with Hom Sets and Hom Functions? Thanks, Mark Spezzano. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Category Theory woes

2010-02-02 Thread Mark Spezzano
I should probably add that I am trying various proofs that involve injective and surjective properties of Hom Sets and Hom functions. Does anyone know what Hom stands for? I need a text for a newbie. Mark On 02/02/2010, at 9:56 PM, Mark Spezzano wrote: Hi all, I'm trying to learn Haskell

Re: [Haskell-cafe] Trapping getChar before echo

2010-02-01 Thread Mark Spezzano
I've tried this example and it just lets me type in anything in CAPITALS, which is nice, but Delete key doesn't delete and the arrow keys unfortunately let me manoeuvre the cursor all over the screen. Also the biggest problem is that Enter doesn't terminate the input session. Isn't there a

[Haskell-cafe] Trapping getChar before echo

2010-01-31 Thread Mark Spezzano
in whatever case they were typed. I want to sneak in a toUpper in before the Chars get echoed. Thanks Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Parsers for Text Adventures

2010-01-17 Thread Mark Spezzano
be misusing them in this context. Thanks Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Referential Transparency and Monads

2009-04-09 Thread Mark Spezzano
on monads? Or does RT ignore the encapsulated data and just view the “action” performed by the monad as the “value” of the monad? Just curious as to the rationale behind referential transparency and how it applies to monads. Cheers, Mark Spezzano No virus found in this outgoing

[Haskell-cafe] Definition of tail recursive wrt Folds

2009-03-25 Thread Mark Spezzano
recursive” as opposed to just “recursive”? Cheers, Mark Spezzano No virus found in this outgoing message. Checked by AVG. Version: 7.5.557 / Virus Database: 270.11.27/2021 - Release Date: 24/03/2009 4:00 PM ___ Haskell-Cafe mailing list Haskell

[Haskell-cafe] Ease of Haskell development on OS X?

2009-03-20 Thread Mark Spezzano
should be aware of before changing systems (i.e. unpleasant surprises). I want to be able to use the machine for Haskell OpenGL programming. Cheers, Mark Spezzano No virus found in this outgoing message. Checked by AVG. Version: 7.5.557 / Virus Database: 270.11.20/2012 - Release

[Haskell-cafe] OpenGL Linking Issue

2009-03-18 Thread Mark Spezzano
reference to `glutgetprocaddr...@4' collect2: ld returned 1 exit status What’s happening here? Obviously it’s a linking issue, but I was wondering whether I need to include some library or file or option to ghc so that it links correctly. Cheers, Mark Spezzano No virus found

[Haskell-cafe] Haskell, OpenGL on Windows

2009-03-17 Thread Mark Spezzano
Hi, Can someone PLEASE help me to understand exactly how to configure OpenGL on Window using Haskell. I'm using Eclipse IDE. When I try to run the file Test1.hs in GHCi then I get the following error: Loading package syb ... linking ... done. Loading package base-3.0.3.0 ... linking ... done.

[Haskell-cafe] DLL Hell: OpenGL

2009-03-17 Thread Mark Spezzano
As far as I know, -lSM is to do with XWindows (not windows Vista).How do I fix this ? What’s going on? I’ve been on this problem now for hours, and all I wanted to do was get a window up on the screen. Sigh Mark Spezzano No virus found in this outgoing message. Checked by AVG. Version: 7.5.557

[Haskell-cafe] OpenGL and Cabal installation

2009-03-17 Thread Mark Spezzano
everywhere in my PATH but msys won’t find them. Cheers, Mark Spezzano No virus found in this outgoing message. Checked by AVG. Version: 7.5.557 / Virus Database: 270.11.18/2008 - Release Date: 17/03/2009 4:25 PM ___ Haskell-Cafe mailing list Haskell

[Haskell-cafe] Map in Terms of Fold in terms of Map

2009-03-16 Thread Mark Spezzano
Hi, I’ve noticed that it’s possible to define map as foldr and foldr as a map. Would this be sensible to define both in terms of each other in the Prelude? i.e mutually recursive? Cheers, Mark No virus found in this outgoing message. Checked by AVG. Version: 7.5.557 / Virus

[Haskell-cafe] Default Tuple Orderings

2009-03-15 Thread Mark Spezzano
the “smallest” tuple (according to the above rules and if xs is a list of tuples)? Cheers, Mark Spezzano No virus found in this outgoing message. Checked by AVG. Version: 7.5.557 / Virus Database: 270.11.13/2001 - Release Date: 14/03/2009 6:54 AM

[Haskell-cafe] Natural Numbers: Best implementation?

2009-03-12 Thread Mark Spezzano
got that feeling that [2] would be fast and [3] would be slow. Comment appreciated on the merits of each. Cheers, Mark Spezzano No virus found in this outgoing message. Checked by AVG. Version: 7.5.557 / Virus Database: 270.11.12/1998 - Release Date: 12/03/2009 6:23 PM

[Haskell-cafe] Generics Versus Parametric Polymorphism

2009-03-11 Thread Mark Spezzano
? Or is generics in Haskell referring to something completely different. Cheers, Mark Spezzano No virus found in this outgoing message. Checked by AVG. Version: 7.5.557 / Virus Database: 270.11.9/1993 - Release Date: 10/03/2009 7:19 AM ___ Haskell

[Haskell-cafe] Design Patterns by Gamma or equivalent

2009-03-11 Thread Mark Spezzano
again and again to solve problems. If so, what are they called? Cheers, Mark Spezzano No virus found in this outgoing message. Checked by AVG. Version: 7.5.557 / Virus Database: 270.11.9/1993 - Release Date: 10/03/2009 7:19 AM

[Haskell-cafe] Parallel programming in Haskell (threads, cores, processors)

2009-03-10 Thread Mark Spezzano
Hi, I’m an experienced software developer, but a bit of a newbie when it comes to parallel processing in any language. I’ve done some multithreading in Java and C++ on a single processor, single core architecture only. First, let me define some terms: Multithreading: this is

[Haskell-cafe] Parallel programming (threads, cores, processors)

2009-03-10 Thread Mark Spezzano
Hi, I’m an experienced software developer, but a bit of a newbie when it comes to parallel processing in any language. I’ve done some multithreading in Java and C++ on a single processor, single core architecture only. First, let me define some terms: Multithreading: this is

[Haskell-cafe] Good books on advanced topics

2009-01-31 Thread Mark Spezzano
Hi, Is there a good book on some of the more advanced or esoteric Haskell topics, like monads, and morphisms, category theory etc. Cheers, Mark No virus found in this outgoing message. Checked by AVG. Version: 7.5.552 / Virus Database: 270.10.12/1910 - Release Date: 22/01/2009