Re: [Haskell-cafe] Indenting with PPrint

2007-05-07 Thread Joel Reymont
Brandon, On May 8, 2007, at 12:33 AM, Brandon Michael Moore wrote: braces x = group (PP. braces (nest 4 (linebreak <> x) <> linesbreak) I ended up with the following: nest = PP.nest 4 braces x = nest (lbrace <$> x) <$> rbrace If you happen to be formatting C I've also worked out how to get

Re: [Haskell-cafe] GHC Hangs

2007-05-07 Thread Josiah Manson
I have generated log files with both filemon and procmon. The procmon output may be useful. ghc.exe launches gcc.exe which launches as.exe which does various things, but the last thing as.exe does before all goes silent is this line: 1655510:24:30.0592945 PMas.exe4364RegOpenKey HK

[Haskell-cafe] Re: a question concerning type constructors

2007-05-07 Thread oleg
> In Haskell, is it possible to declare a type constructor with a variable > number of type variables e.g. > > data Tuple * > > allowing the following declarations: > > t: Tuple > u: Tuple Bool > v: Tuple Bool Int > w: Tuple Bool Int Char Although the data constructor such as the `Tuple' is

Re: [Haskell-cafe] GHC Hangs

2007-05-07 Thread Dan Piponi
On 5/7/07, Josiah Manson <[EMAIL PROTECTED]> wrote: When the intermediate files are removed, GHC still hangs. In fact, the intermediate files do not seem to be corrupt in any way, as the only way to get a working executable is to run GHC more than once. First to produce the intermediate files, t

Re: [Haskell-cafe] GHC Hangs

2007-05-07 Thread Josiah Manson
When the intermediate files are removed, GHC still hangs. In fact, the intermediate files do not seem to be corrupt in any way, as the only way to get a working executable is to run GHC more than once. First to produce the intermediate files, then to link them into an executable. On 5/7/07, Cale

Re: [Haskell-cafe] GHC Hangs

2007-05-07 Thread Josiah Manson
http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-i386-windows-test1.exe Might be worth trying that to see if there's still a problem. There is still a problem when I use the version you linked to. At first I was hopeful, because the first time I tried compiling bisect.hs it worked. All subseque

Re: [Haskell-cafe] Indenting with PPrint

2007-05-07 Thread Brandon Michael Moore
On Mon, May 07, 2007 at 10:38:19PM +0100, Joel Reymont wrote: > Folks, > > Are you using UU.PPrint [1]? Can you tell me how to print stuff like > this? > > { > blah > blah > } > > I tried the following which sort of works but doesn't return the > closing brace to the indentation le

[Haskell-cafe] How to parse a date and time?

2007-05-07 Thread Justin Bailey
Looking at the libraries documentation, it seems like parsing a string into a time and date should be as simple as: import Data.Time.Format (parseTime) myDate = parseTime "..." where "..." is some string. But these functions don't seem to exist! I can't find many references to them in the wild

Re: [Haskell-cafe] GHC Hangs

2007-05-07 Thread Anatoly Yakovenko
i've run ghc 6.6, and other open source software, on a core duo thinkpad without any problems. building bisect.hs works fine as well. I am using the winxp professional sp 2. On 5/7/07, Josiah Manson <[EMAIL PROTECTED]> wrote: Hello Haskellers, I have a problem where GHC will hang after compili

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Dougal Stanton
On 07/05/07, David House <[EMAIL PROTECTED]> wrote: represented by a null pointer. So such luck with unboxed types. So working with unboxed types is quicker and consumes less memory, but don't use them in any kind of high level because the lack of a _|_ will bite you sooner or later. I hesitate

[Haskell-cafe] Indenting with PPrint

2007-05-07 Thread Joel Reymont
Folks, Are you using UU.PPrint [1]? Can you tell me how to print stuff like this? { blah blah } I tried the following which sort of works but doesn't return the closing brace to the indentation level of the first one. braces x = PP.braces $ linebreak <> indent 4 x Than

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Duncan Coutts
On Mon, 2007-05-07 at 21:50 +0100, David House wrote: > On 07/05/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: > > (Anybody know what the difference between GHC.Prim.Double# > > and GHC.Float.Double is?) > > It's the difference between unboxed and boxed types. A boxed type's > representation is in

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread David House
On 07/05/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: (Anybody know what the difference between GHC.Prim.Double# and GHC.Float.Double is?) It's the difference between unboxed and boxed types. A boxed type's representation is in fact a pointer to the unboxed type (I think), so that a Double woul

Re: [Haskell-cafe] Arbitrary precision?

2007-05-07 Thread Henning Thielemann
On Sun, 6 May 2007, Andrew Coppin wrote: > Greetings. > > Haskell has arbitrary precision integers, in the form of the Integer > type. Is there a type somewhere that implements arbitrary precision > fractional values? Whatever you want: http://haskell.org/haskellwiki/Applications_and_libraries

Re: [Haskell-cafe] symbol $

2007-05-07 Thread Andrew Coppin
(False,Var n) else (True,Val (envLookup n env)) evalExpr c@(App op e1 e2) e = let (b1,v1) = (evalExpr e1 e) (b2,v2) =(evalExpr e2 e)> in if b1 && b2 then (True,Val (eval c e)) else (False,App op v1 v2) Allows you to ref

Re: [Haskell-cafe] symbol $

2007-05-07 Thread Maverick
Thanks a lot for your help I got the idea of this symbol now. It will be great if you can help me this time as well, this time is the symbol @ Here is the code that i got > evalExpr :: Expr -> Mem -> (Bool,Expr) > evalExpr (Val x) _= (True,Val x) > eval

Re: [Haskell-cafe] Haskell Weekly News: May 07, 2007

2007-05-07 Thread Andrew Coppin
--- Haskell Weekly News http://sequence.complete.org/hwn/20070507 Issue 62 - May 07, 2007 --- Chaos. Andrew Coppin [29]announced chaos, a fun

Re: [Haskell-cafe] (Chaos) [An interesting toy]

2007-05-07 Thread Andrew Coppin
Simon Peyton-Jones wrote: | I wonder... is there a high-level document anywhere which explains what | GHC actually does with your code when you compile it? A lot, actually: http://hackage.haskell.org/trac/ghc/wiki/Commentary Ooo... candy! (By the way... I'm loving the whole concept of "Th

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Andrew Coppin
So... if I'm not actually using lazyness for anything, would it do any harm to change Double to Double# in the Haskell source code? Or is there some reason why this would be undesirable? (The source is carefully constructed Well, you'd need -fglasgow-exts for it to even compile. Other than

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Malte Milatz
Sorry, my mail client fooled me, too, so here it is again: Andrew Coppin: > What I'm trying to say is, I would have expected, say, > > resultant :: [Vector2] -> Vector2 > resultant = sum > > to run faster than > > resultant = sum > > In the latter case, we have resultant :: (Num n) => [n

Re: [Haskell-cafe] Monad and Monad transformer ???

2007-05-07 Thread Stefan Holdermans
Maverick, Can you please tell me is how different Monad and Monad transformer is? Perhaps this is of interest to you: http://www.haskell.org/all_about_monads/html/ HTH, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.

Re: [Haskell-cafe] symbol $

2007-05-07 Thread Stefan Holdermans
Maverick, Do you mind tell what is mean by the symbol $ in this piece of code? Thanks a lot. It denotes function application: infixr 1 $ ($) :: (a -> b) -> a -> b f $ x = f x Note how its precedence and associativity is the opposite of that of 'regular' function application. Th

[Haskell-cafe] Monad and Monad transformer ???

2007-05-07 Thread Maverick
hi I am a newbee to haskell so please forgive me if the question is not appropreate. I am trying to get the idea of using Monad and have to understand the following code. Can you please tell me is how different Monad and Monad transformer is? And what is mean by > newtype State s a = State {

[Haskell-cafe] symbol $

2007-05-07 Thread Maverick
Hi Do you mind tell what is mean by the symbol $ in this piece of code? Thanks a lot. > mcompile :: Prog -> State Int Code > mcompile (Assign n e) = return $ compileExpr e ++ [POP n] > mcompile (If e p1 p2) = do cur <- fresh >pp1 <- mcompile p1 >

RE: [Haskell-cafe] (Chaos) [An interesting toy]

2007-05-07 Thread Simon Peyton-Jones
| I wonder... is there a high-level document anywhere which explains what | GHC actually does with your code when you compile it? A lot, actually: http://hackage.haskell.org/trac/ghc/wiki/Commentary ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.o

Re: [Haskell-cafe] (Chaos) [An interesting toy]

2007-05-07 Thread Andrew Coppin
Simon Peyton-Jones wrote: | Ah well, I doubt I'm going to come up with any new ideas for how to make | my code go faster, but it's mildly entertaining wading through over 200 | KB of textual output trying to guess what it means. Ha ha. You did say that you wanted to know what GHC *really* does

[Haskell-cafe] GHC Hangs

2007-05-07 Thread Josiah Manson
Hello Haskellers, I have a problem where GHC will hang after compiling a file. The problem seems to occur with my computer, but not with everyone else's. I hope that someone my be able to diagnose my problem. My computer is an Acer Aspire 5670, which runs on an Intel Core Duo T2300 and runs Wind

RE: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Simon Peyton-Jones
| Ah well, I doubt I'm going to come up with any new ideas for how to make | my code go faster, but it's mildly entertaining wading through over 200 | KB of textual output trying to guess what it means. Ha ha. You did say that you wanted to know what GHC *really* does :-) Seriously, there is mi

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Brandon S. Allbery KF8NH
On May 7, 2007, at 8:50 , Andrew Coppin wrote: recognisable expression involving GHC.Prim.+##. (Anybody know what the difference between GHC.Prim.Double# and GHC.Float.Double is?) This in spite of the fact that the definition is actually Double# is an unboxed (raw) double; Double is boxed,

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Andrew Coppin
Simon Peyton-Jones wrote: | I guess I was assuming that a function like sum is "simple enough" to | get inlined at the call site - and hence possibly optimised at that | site. Apparently not. There is no reason in principle why not. It's just that GHC doesn't do it at the moment. On one h

Re: [Haskell-cafe] Intermediate Haskell Books?

2007-05-07 Thread Bulat Ziganshin
Hello Adrian, Sunday, May 6, 2007, 12:24:27 PM, you wrote: > Are there any good books about intermediate to advanced Haskell? The perhaps, "Purely Functional Data Structures" by Okasaki? also, "Applications of Functional Programming" may be interesting -- Best regards, Bulat

RE: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Simon Peyton-Jones
| Presumably changing it to resultant = foldl' (+) wouldn't help much either? I think not. | Seems to me there's always a tradeoff to be made between CPU time, RAM | usage, and code size - if not other factors too. :-S But Haskell seems | to be fairly unique in that (it looks like) it's possible

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Andrew Coppin
| In the latter case, we have resultant :: (Num n) => [n] -> n. I'm no | expert, but I would expect that this requires a method lookup on each | call, whereas with the more restrictive type I would expect the compiler | to be able to just link directly to the correct method implementation. | Am

RE: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Simon Peyton-Jones
| What I'm trying to say is, I would have expected, say, | | resultant :: [Vector2] -> Vector2 | resultant = sum | | to run faster than | | resultant = sum | | In the latter case, we have resultant :: (Num n) => [n] -> n. I'm no | expert, but I would expect that this requires a method lookup

[Haskell-cafe] The Monad.Reader - Call for copy

2007-05-07 Thread Wouter Swierstra
Call for Copy The Monad.Reader - Issue 8 I would like to welcome articles for the next issue of The Monad.Reader. * The Monad.Reader * The Monad.Reader is a electronic magazine about all things Haskell. It is less-formal than journal,

Re: [Haskell-cafe] c2hs errors when compiling hsGnuTls

2007-05-07 Thread David House
On 06/05/07, Duncan Coutts <[EMAIL PROTECTED]> wrote: Try the latest darcs version of c2hs, it has a new C parser which should fix issues like this. We should have a new tarball release soon. Works great. Thanks very much. -- -David House, [EMAIL PROTECTED]

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Andrew Coppin
Simon Peyton-Jones wrote: | The source code has explicit monomorphic types all over it; I would | expect GHC to be able to optimise out any method calls. (OTOH, I'm not a | GHC expert... Simon? Don?) Full monomorphisation is a whole-program optimisation and GHC isn't (yet) a whole-program compi

[Haskell-cafe] Kleene star in types

2007-05-07 Thread Matthew Sackman
Apologies for sending this twice. Mutt obviously outsmarted mailman and put a useful mime type header in. Not so this one! This email is a .lhs. > {-# OPTIONS -fglasgow-exts #-} > {-# OPTIONS -fallow-undecidable-instances #-} > {-# OPTIONS -fallow-overlapping-instances #-} Let's implement the Kl

[Haskell-cafe] Kleene star in types

2007-05-07 Thread Matthew Sackman
This email is a .lhs. > {-# OPTIONS -fglasgow-exts #-} > {-# OPTIONS -fallow-undecidable-instances #-} > {-# OPTIONS -fallow-overlapping-instances #-} Let's implement the Kleene * in the type system. First some phantom types: > data At n > data Bt n > data Ct n > data Endt Now a chain to hold i

[Haskell-cafe] RE: [Haskell] Monad and Monad transformer???

2007-05-07 Thread Simon Peyton-Jones
As someone mentioned, don't worry about being new to Haskell, but DO send your messages to haskell-cafe@haskell.org, not the main Haskell list. I'm redirecting this so that the Helpful Denizens of the Haskell Cafe can help you. Simon | -Original Message- | From: [EMAIL PROTECTED] [mail

RE: [Haskell-cafe] GADTs, type classes, existentials

2007-05-07 Thread Simon Peyton-Jones
| Type classes and GADTs are broken in all versions prior to HEAD (at | which point Simon made a heroic effort to do something I don't quite | understand to the type checker). Well, not that heroic, but certainly long-postponed :-) Simon ___ Haskell-Caf

RE: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Simon Peyton-Jones
| The source code has explicit monomorphic types all over it; I would | expect GHC to be able to optimise out any method calls. (OTOH, I'm not a | GHC expert... Simon? Don?) Full monomorphisation is a whole-program optimisation and GHC isn't (yet) a whole-program compiler. Overloaded functions a

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Vincent Kraeutler
Andrew Coppin wrote: [snip] > Fact #1: I don't *know* of any other numerical integration algorithm. > (I've heard of RK4, but it's too complicated for me to understand.) higher-order runge-kutta algorithms typically have high integration accuracy, but may require multiple energy/force evaluations

Re: [Haskell-cafe] The Trivial Monad

2007-05-07 Thread Ketil Malde
On Fri, 2007-05-04 at 20:02 +0400, Bulat Ziganshin wrote: >> don't understand what this monad thingy is all about. > the whole monadic business was introduced with the sole goal to let > haskellers believe that they are smarter than other programmers :) Or perhaps to ensure that they are? -k _