Re: [Haskell-cafe] Glome.hs-0.3 (ray tracing digression)

2008-04-27 Thread Andrew Coppin
Jim Snow wrote: I guess a pov importer wouldn't necessarily be all that difficult, or an exporter, for that matter. (Supporting every single primitive type, texture, and rendering feature would be a daunting challenge, but just supporting the basics might be relatively simple.) The problem

Re: [Haskell-cafe] lookup tables style guidelines

2008-04-27 Thread Adrian Hey
Jan-Willem Maessen wrote: Just to clarify: divide and conquer splits one tree on the root value of the other (possibly avoiding enforcing the balance metric until after joining trees, though not obvious how / if that's useful)? The definition of divide and conquer on trees without a fixed

[Haskell-cafe] [help] Program immplementing an alarm

2008-04-27 Thread Antonio Regidor García
Hi, I'm trying to implement an alarm in Haskell and wrote the following code: http://hpaste.org/7201 But it doesn't work as expected. The expected behaviour is: The user enters a time in minutes. If the time is reached, a bell rings. If, before the time is reached, he press enter, the program

[Haskell-cafe] Finite Difference Implementation

2008-04-27 Thread Fernan Bolando
Hi all I was wondering if anyone has or knows of a Finite Difference or Finite Element Implementation in pure haskell. I would like to write this myself, but my haskell skills is not that good. I did a bit of google search I've seen it bieng discussed, but did not point to an actual code.

Re: [Haskell-cafe] Caching the Result of a Transaction?

2008-04-27 Thread Jake Mcarthur
On Apr 27, 2008, at 10:05 AM, Jake Mcarthur wrote: On Apr 27, 2008, at 9:36 AM, Conal Elliott wrote: I think we *do* want unsafeNewEmptyTMVar inlined. Here's a convenient caching wrapper: cached :: STM a - TIVal a cached m = TIVal m (unsafePerformIO newEmptyTMVarIO) Yes, this is

Re: [Haskell-cafe] Help with complicated type inference

2008-04-27 Thread Iavor Diatchki
Hello, How about defining the types like this: data PVal a = Unit a | Array [a] data Val = IntVal (PVal Int) | BoolVal (PVal Bool) -- | etc instance Serialize Int where ... instance Serialize a = Serialize (PVal a) where ... instance Serialize Val where ... Hope this helps. -Iavor On Sun,

Re: [Haskell-cafe] Help with complicated type inference

2008-04-27 Thread Niklas Broberg
On 4/27/08, Paul Johnson [EMAIL PROTECTED] wrote: I'm trying to write an AMQP framing layer. AMQP has two very similar union types: there is a variant that contains a single item, and an array which consists of a list of elements of the same type. So I thought I could define a Unit type

[Haskell-cafe] some questions about type improvement, FDs vs TFs, and Hugs vs GHCi

2008-04-27 Thread Claus Reinke
consider class FD a b | a - b instance CFD a b = FD a b class CFD a b instance CFD Bool Char and the constraint 'CFD Bool c'. logically, we know that if we have 'CFD Bool c', we also have 'FD Bool c', which implies that 'c' is uniquely determined, which implies that 'c~Char'.

[Haskell-cafe] question about GHC and Unicode

2008-04-27 Thread Daniel Gee
In GHC there's a GHC.Unicode library, but for a string such as ΧΑΟΣΣ, a GHC compiled program prints it as a string of unknown characters, and in the interpreter, the string evaluates to a string of escape sequences instead of displaying properly. Is there a way to get/activate unicode support in

Re: [Haskell-cafe] question about GHC and Unicode

2008-04-27 Thread Daniel Gee
On Sun, Apr 27, 2008 at 1:02 PM, Don Stewart [EMAIL PROTECTED] wrote: GHC supports unicode internally, and String and Char are all unicode. To do unicode IO however, you need to use the utf8-string package: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string Just

Re: [Haskell-cafe] question about GHC and Unicode

2008-04-27 Thread Don Stewart
zefria: On Sun, Apr 27, 2008 at 1:02 PM, Don Stewart [EMAIL PROTECTED] wrote: GHC supports unicode internally, and String and Char are all unicode. To do unicode IO however, you need to use the utf8-string package:

Re: [Haskell-cafe] question about GHC and Unicode

2008-04-27 Thread Ian Lynagh
On Sun, Apr 27, 2008 at 12:29:34PM -0700, Donald Bruce Stewart wrote: Ian Lynagh wrote a pure haskell readline implementation a while ago, I think that was Malcolm Wallace. Thanks Ian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] question about GHC and Unicode

2008-04-27 Thread Daniel Gee
ah ha, yes. I seem to have found it here: http://www.haskell.org/pipermail/glasgow-haskell-bugs/2001-April/000401.html I'll use this as a base. Many thanks to the both of you. I'll be sure to submit it to Hackage for others to enjoy if I end up adding some capability to it.

Re: [Haskell-cafe] question about GHC and Unicode

2008-04-27 Thread Don Stewart
zefria: ah ha, yes. I seem to have found it here: http://www.haskell.org/pipermail/glasgow-haskell-bugs/2001-April/000401.html I'll use this as a base. Many thanks to the both of you. I'll be sure to submit it to Hackage for others to enjoy if I end up adding some capability to it. yeah, a

[Haskell-cafe] Function Type Calculation (Take 2)

2008-04-27 Thread PR Stanley
In case you missed it the first time here is my query again: Hi I know we've already looked at the topic of function type calculation though last time I didn't have the chance to go through it thoroughly. So here it is again. Apologies for the repetition. I've had a try at calculating function

Re: [Haskell-cafe] Trouble compiling collections-0.3 (from Hackage)

2008-04-27 Thread Brandon S. Allbery KF8NH
On Apr 27, 2008, at 12:16 , David F. Place wrote: Thanks for the tip. I edited the collections.cabal file to add bytestring to the Build-depends. It also needed containers and array! The build gave streams of warnings and finally failed, so I guess this library is not ready for use.

Re: [Haskell-cafe] Function Type Calculation (Take 2)

2008-04-27 Thread Miguel Mitrofanov
[1] funk f x = f (funk f) x f :: a x :: b funk f x :: c therefore funk :: a - b - c RHS f (funk f) x :: c f (funk f) :: d - c x :: d f :: e - d - c funk :: h - e f :: h

Re: [Haskell-cafe] question about GHC and Unicode

2008-04-27 Thread Malcolm Wallace
Ian Lynagh wrote a pure haskell readline implementation a while ago, I think that was Malcolm Wallace. ... and it is part of the readline package! See System.Console.SimpleLineEditor. Needless to say, it is far from perfect, but does give some basic facilities. There are lots of ways

Re: [Haskell-cafe] question about GHC and Unicode

2008-04-27 Thread Duncan Coutts
On Sun, 2008-04-27 at 21:44 +0100, Malcolm Wallace wrote: Ian Lynagh wrote a pure haskell readline implementation a while ago, I think that was Malcolm Wallace. ... and it is part of the readline package! See System.Console.SimpleLineEditor. Needless to say, it is far from

Re: [Haskell-cafe] Trouble compiling collections-0.3 (from Hackage)

2008-04-27 Thread Adrian Hey
David F. Place wrote: Thanks for the tip. I edited the collections.cabal file to add bytestring to the Build-depends. It also needed containers and array! The build gave streams of warnings and finally failed, so I guess this library is not ready for use. I don't think anyone is

[Haskell-cafe] approximating pi

2008-04-27 Thread ry dahl
By picking points randomly from a square one can calculate pi. Keep track of how many points from the square you pick lay in the inscribed circle. Supposing the square's edges are length 2, then the inscribed circle has radius 1. Thus the area of the circle is pi*r^2 = pi. The area of the square

Re: [Haskell-cafe] approximating pi

2008-04-27 Thread Don Stewart
ry: By picking points randomly from a square one can calculate pi. Keep track of how many points from the square you pick lay in the inscribed circle. Supposing the square's edges are length 2, then the inscribed circle has radius 1. Thus the area of the circle is pi*r^2 = pi. The area of the

Re: [Haskell-cafe] approximating pi

2008-04-27 Thread jerzy . karczmarczuk
Don Stewart writes: Ry Dahl: By picking points randomly from a square one can calculate pi. ... What is the best way to express this algorithm in Haskell? Using a random generator, such as System.Random or System.Random.Mersenne, generate random numbers in your range, testing if they're

Re: [Haskell-cafe] approximating pi

2008-04-27 Thread Derek Elkins
On Mon, 2008-04-28 at 02:54 +0200, [EMAIL PROTECTED] wrote: Don Stewart writes: Ry Dahl: By picking points randomly from a square one can calculate pi. ... What is the best way to express this algorithm in Haskell? Using a random generator, such as System.Random or

[Haskell-cafe] ANNOUNCE: category-extras 0.2

2008-04-27 Thread Dan Doel
Hello, all. After quite a bit of collaboration with Edward Kmett over the past few days, I've rolled up a new release of category-extras. Perhaps the most significant addition is the generalized hylomorphism he first blogged about here:

Re: [Haskell-cafe] approximating pi

2008-04-27 Thread Benjamin L. Russell
Assuming the square had 100 pixels per side, on the average, approximately how many random pixels should be plotted in the square before obtaining a reasonably good estimate of pi? Benjamin L. Russell --- On Mon, 4/28/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: From: [EMAIL PROTECTED]