[Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread minh thu
Hi, I'd like to process some kind of graph data structure, say something like data DS = A [DS] | B DS DS | C. but I want to be able to discover any sharing. Thus, in b = B a a where a = A [C], if I want to malloc a similar data structure, I have to handle to the node representing B two times t

RE: [Haskell-cafe] Template Haskell question

2009-01-08 Thread Simon Peyton-Jones
Good tricks! Would one of you like to write them up on the Wiki? http://haskell.org/haskellwiki/Template_Haskell Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of | Ryan Ingram | Sent: 08 January 2009 01:55 | To:

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Luke Palmer
On Thu, Jan 8, 2009 at 1:28 AM, minh thu wrote: > Hi, > > I'd like to process some kind of graph data structure, > say something like > > data DS = A [DS] | B DS DS | C. > > but I want to be able to discover any sharing. > Thus, in > > b = B a a where a = A [C], > > if I want to malloc a similar

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Lennart Augustsson
Of course you don't need a monad, but you need to do the same operations as you would with a state monad to number the nodes. This is the only way in (pure) Haskell. There is no object identity in Haskell, so if you want the nodes to have identity you need to provide it. GHC does have a library

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread minh thu
2009/1/8 Luke Palmer : > On Thu, Jan 8, 2009 at 1:28 AM, minh thu wrote: >> >> Hi, >> >> I'd like to process some kind of graph data structure, >> say something like >> >> data DS = A [DS] | B DS DS | C. >> >> but I want to be able to discover any sharing. >> Thus, in >> >> b = B a a where a = A [

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread minh thu
Well, the processing of the data structure has to be done in the IO monad. What is the library you talk about ? Could it give the "stable names" (in IO) for each node of the mentioned graph (I mean, after the graph has been constructed purely) ? Thanks, Thu 2009/1/8 Lennart Augustsson : > Of cour

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread minh thu
Great, System.Mem.StableName [1] seems to be able to do the trick. Thank you. [1] http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-StableName.html 2009/1/8 minh thu : > Well, the processing of the data structure has to be done in the IO monad. > What is the library you talk

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Lennart Augustsson
Look at http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-StableName.html. But what's wrong with constructing the graph in a monad? On Thu, Jan 8, 2009 at 9:53 AM, minh thu wrote: > Well, the processing of the data structure has to be done in the IO monad. > What is the libr

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Luke Palmer
On Thu, Jan 8, 2009 at 1:49 AM, minh thu wrote: > I'd like to simply write, like above, > > b = B a a where a = A [C] > > or, maybe, > > b = B label a a where a = A label [C] > > The question is : how can label be different each time ? Haskell is pure, so I can answer this precisely: obviously

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread minh thu
Nothing, simply the notation. Now, with the remark of Luke, I'm wondering how bad it is to use makeStableName/hashStableName to "copy" the data structure in a similar one with explicit reference (that is, using pointer or keys in a map or whatever). Thank you, Thu 2009/1/8 Lennart Augustsson : >

[Haskell-cafe] Debugging STM

2009-01-08 Thread John Ky
Hi, Does anyone have any advice on how to inspect complex TVar data structures that may include cycles? They're opaque as far as Show goes. And sometimes I'd like a more comprehensive view of my data structures at the ghci prompt rather than the dribs and drabs I get by typing "x <- atomically $

Re: [Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread Manlio Perillo
Tony Hannan ha scritto: Let me give you more information about this hypothetical job posting. Our company is a startup CDN (http://en.wikipedia.org/wiki/Content_Delivery_Network) about 3 years old and doing well. You would hythothetically be one of 7 programmer who write all the software invol

[Haskell-cafe] Computer time, independent of date

2009-01-08 Thread Mauricio
Hi, I'm writing a program where I need to know elapsed times between some events, but I can't depende on Data.Time since ntpd or user can change that while my program is running. Is there an alternative? Something like how much time has passed since the program has started would be great. Thank

[Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Achim Schneider
Manlio Perillo wrote: > Unfortunately Haskell is not yet ready for this task. > Could you -- or someone else -- please elaborate on this? I've heard it once in the context of a webbrowser, the reason given was that ghc doesn't deallocate memory, that is, the gc heap only increases. I doubt it'd

Re: [Haskell-cafe] ideas for a phd in the area of paralleism?

2009-01-08 Thread nml
Hi, check http://www.intellasys.net/index.php?option=com_content&task=view&id=35 http://groups.google.com.tw/group/seaforth That's a FORTH cpu I ever took a look one year ago when my professor introduced it. It has some very promising features as the above links claims.The most impressiv

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Manlio Perillo
Achim Schneider ha scritto: Manlio Perillo wrote: Unfortunately Haskell is not yet ready for this task. Could you -- or someone else -- please elaborate on this? Here is a list of things that I would like to see in GHC to start developing a server application (in order of importance) 1

Re: [Haskell-cafe] Computer time, independent of date

2009-01-08 Thread Marc Weber
> Is there an alternative? Something like how much > time has passed since the program has started would > be great. Have a look at benchpress on hackage. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.o

[Haskell-cafe] Re: How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Ertugrul Soeylemez
"minh thu" wrote: > Nothing, simply the notation. Now, with the remark of Luke, I'm > wondering how bad it is to use makeStableName/hashStableName to "copy" > the data structure in a similar one with explicit reference (that is, > using pointer or keys in a map or whatever). Probably you're misu

[Haskell-cafe] Re: Computer time, independent of date

2009-01-08 Thread Mauricio
Is there an alternative? Something like how much time has passed since the program has started would be great. Have a look at benchpress on hackage. But benchpress uses Data.Time.Clock.getCurrentTime. I understand that is dependent from configuration. It's okay to benchmark a fast applicat

Re: [Haskell-cafe] Re: How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread minh thu
2009/1/8 Ertugrul Soeylemez : > "minh thu" wrote: > >> Nothing, simply the notation. Now, with the remark of Luke, I'm >> wondering how bad it is to use makeStableName/hashStableName to "copy" >> the data structure in a similar one with explicit reference (that is, >> using pointer or keys in a ma

Re: [Haskell-cafe] State Monad - using the updated state

2009-01-08 Thread Kurt Hutchinson
Ryan gave some great advice about restructuring your program to do what you want, but I wanted to give a small explanation of why that's necessary. 2009/1/7 Phil : > I want to be able to do: > > Get_a_random_number > > < a whole load of other stuff > > > Get the next number as defined by the upda

[Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Thomas Hallgren
On 2009-01-08 12:10, Achim Schneider wrote: Manlio Perillo wrote: Unfortunately Haskell is not yet ready for this task. Could you -- or someone else -- please elaborate on this? I think Haskell is ready for a lot more than most people think. How about an operating system in Haskell, for e

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John A. De Goes
Haskell's networking support is very rudimentary. Erlang's is quite sophisticated. For network intensive applications, especially those requiring messaging, fault-tolerance, distribution, and so forth, there's no doubt that Erlang is a more productive choice. Not because of the language,

Re: [Haskell-cafe] Taking Exception to Exceptions

2009-01-08 Thread Cristiano Paris
On Thu, Jan 8, 2009 at 12:32 AM, Austin Seipp wrote: > Excerpts from Immanuel Litzroth's message of Wed Jan 07 16:53:30 -0600 2009: > ... >> I am little amazed that I cannot get catch, try or mapException to work >> without telling them which exceptions I want to catch. >> What is the rationale be

Re: [Haskell-cafe] Re: Blitting one IOUArray into another

2009-01-08 Thread Bueno, Denis
On 01/07/2009 14:36 , "Neal Alexander" wrote: > Bueno, Denis wrote: >> Oh, do you mean by actually calling memcpy via ffi? > > http://www.haskell.org/ghc/docs/latest/html/libraries/base/Foreign-Marshal-Uti > ls.html Ah, thanks. Is there a way to simply "cast" an IOUArray Int Int64 into somethi

Re: [Haskell-cafe] Re: Computer time, independent of date

2009-01-08 Thread Martijn van Steenbergen
Mauricio wrote: But benchpress uses Data.Time.Clock.getCurrentTime. I understand that is dependent from configuration. It's okay to benchmark a fast application, but mine will be running for days, so it would not be reliable. benchpress also uses System.CPUTime -- is that what you are looking f

Re: [Haskell-cafe] Taking Exception to Exceptions

2009-01-08 Thread Immanuel Litzroth
> > > I recommend this paper for info, it's very easy to follow: > > http://www.haskell.org/~simonmar/papers/ext-exceptions.pdf > > Austin > That paper cleared up most of my issues and it is amazing that it is not amongst the papers that

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Creighton Hogg
On Thu, Jan 8, 2009 at 8:32 AM, John A. De Goes wrote: > > Haskell's networking support is very rudimentary. Erlang's is quite > sophisticated. For network intensive applications, especially those > requiring messaging, fault-tolerance, distribution, and so forth, there's no > doubt that Erlang is

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John A. De Goes
Take, for example, RabbitMQ. There's nothing even remotely close in Haskell-land. RabbitMQ is written in 100% Erlang. It's built on Open Telecom Platform, which again is without equal in Haskell. There are a lot of theoretical reasons why Haskell would be a good choice to build librarie

Re: [Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread david48
On Thu, Jan 8, 2009 at 11:58 AM, Manlio Perillo wrote: > Unfortunately Haskell is not yet ready for this task. What makes you say that ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Defining methods generically for a class

2009-01-08 Thread Jeff Heard
I have the following class: class Region a where numDimensions :: a -> Int dim :: Int -> a -> (Double,Double) merge :: a -> a -> a and several ancillary methods defined, the most importance of which is: bounds :: Region a => a -> [(Double,Double)] bounds r = take (numDimensions r) .

Re: [Haskell-cafe] Defining methods generically for a class

2009-01-08 Thread Cristiano Paris
On Thu, Jan 8, 2009 at 6:04 PM, Jeff Heard wrote: > ... > How do I declare all Regions to be Eqs without putting it in the class > body (since I define a function over all Regions that is independent > of datatype that is an instance of Region)? Would this be a solution? class Eq a => Region a w

Re: [Haskell-cafe] Defining methods generically for a class

2009-01-08 Thread Martijn van Steenbergen
Hi Jeff, Jeff Heard wrote: instance Region a => Eq a where regiona == regionb = all $ zipWith (==) (bounds regiona) (bounds regionb) If you want to be Haskell98 compliant, why not define regionEquals :: Region a => a -> a -> Bool as above and use that everywhere instead of (==)? If you i

Fwd: [Haskell-cafe] Defining methods generically for a class

2009-01-08 Thread Jeff Heard
-- Forwarded message -- From: Jeff Heard Date: Thu, Jan 8, 2009 at 12:26 PM Subject: Re: [Haskell-cafe] Defining methods generically for a class To: Cristiano Paris Not really... I'm not testing if each of the items a are equal, but rather that in the context of them being a Re

Re: [Haskell-cafe] Defining methods generically for a class

2009-01-08 Thread Jeff Heard
That's probably the best thing to do, yes. The purpose of doing so was for Data.List.delete, but I see now there's a Data.List.deleteBy, so I can use the regionEquals function as my equality predicate. On Thu, Jan 8, 2009 at 12:26 PM, Martijn van Steenbergen wrote: > Hi Jeff, > > Jeff Heard wrot

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Tim Newsham
Take, for example, RabbitMQ. There's nothing even remotely close in Haskell-land. That would be useful for systems that require an "enterprise messaging system," I agree, but I don't see how that would be terribly important for a web server or most other networking services I might want to imple

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John A. De Goes
The number of applications requiring the implementation of a custom web server is an insignificant fraction of the number of applications requiring a messaging system. I don't think anyone would dispute Haskell's ability to do low-level, raw networking, of the type that few people actuall

Re: [Haskell-cafe] Taking Exception to Exceptions

2009-01-08 Thread Max Rabkin
On Thu, Jan 8, 2009 at 6:36 AM, Cristiano Paris wrote: > This avoids the possibility of having an unwanted/unknown behavior > from the run-time stack (for example, having the web server returning > a generic 500 Internal Server error report, filled with every sort of > goods a cracker would be hap

Re: [Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread Don Stewart
manlio_perillo: > Tony Hannan ha scritto: > >Let me give you more information about this hypothetical job posting. > >Our company is a startup CDN > >(http://en.wikipedia.org/wiki/Content_Delivery_Network) about 3 years > >old and doing well. You would hythothetically be one of 7 programmer who

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Don Stewart
wchogg: > On Thu, Jan 8, 2009 at 8:32 AM, John A. De Goes wrote: > > > > Haskell's networking support is very rudimentary. Erlang's is quite > > sophisticated. For network intensive applications, especially those > > requiring messaging, fault-tolerance, distribution, and so forth, there's no > >

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John A. De Goes
There's a JavaScript binding to Java, and there's a Java binding to Erlang, so nothing's stopping you from using JavaScript nodes in a distributed fashion -- if you have a weird obsession with proving that JavaScript is well-suited for every task. But really, what's the point? FFI code is

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Creighton Hogg
On Thu, Jan 8, 2009 at 12:06 PM, Don Stewart wrote: > wchogg: >> On Thu, Jan 8, 2009 at 8:32 AM, John A. De Goes wrote: >> > >> > Haskell's networking support is very rudimentary. Erlang's is quite >> > sophisticated. For network intensive applications, especially those >> > requiring messaging,

[Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread ChrisK
John A. De Goes wrote: Here's hoping someone develops a native messaging framework for Haskell, which is the equal of RabbitMQ. The first thing would be to make a Haskell client library to speak AMQP (Advanced Message Queuing Protocol) on the wire. It is a very open binary standard (with

[Haskell-cafe] HookedBuildInfo and Cabal

2009-01-08 Thread John Goerzen
Hi Brian & everyone, Got this bug report, which appears to be related to your autoconf patch. Did you test it on Windows? As a more general question, how can one use Cabal to detect PostgreSQL paths in a way that works with both GHC 6.8 and 6.10? The commit here was: commit 57c723873b020643b90

Re: [Haskell-cafe] Re: How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread minh thu
Interestingly, I failed to detect sharing with StableName. But using the graph node as a key turned to work... If you're interested in the experiment, see attached code. Cheers, Thu 2009/1/8 minh thu : > 2009/1/8 Ertugrul Soeylemez : >> "minh thu" wrote: >> >>> Nothing, simply the notation. Now,

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Tim Newsham
The number of applications requiring the implementation of a custom web server is an insignificant fraction of the number of applications requiring a messaging system. I don't think anyone would dispute Haskell's ability to do low-level, raw networking, of the type that few people actually need

Re: [Haskell-cafe] State Monad - using the updated state

2009-01-08 Thread Phil
I think I've got this now - thanks to you all for the superb advice! The reason I cannot increment state inside main is because main is not a State monad (it's an IO monad). Thus in order to use my State Monad, I have execute inside a State monad as that the state is encapsulated in there. I'll

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John A. De Goes
On Jan 8, 2009, at 12:56 PM, Tim Newsham wrote: You replied to someone discussing using Haskell at a CDN to implement things like web servers by saying that Haskell wasn't suitable for the task. That is incorrect. I replied to Achim's message asking for elaboration on Haskell's unsuitabilit

[Haskell-cafe] "Inconsistency" in support for phantom types?

2009-01-08 Thread DavidA
Hi, I have run into what appears to be an inconsistency in the support for using phantom types to parameterize other types. Here's an example (don't pay too much attention to the maths, it's just there to motivate the example). I want to define types for the finite fields with 2, 3 and 5 elements

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Creighton Hogg
On Thu, Jan 8, 2009 at 2:02 PM, John A. De Goes wrote: > > On Jan 8, 2009, at 12:56 PM, Tim Newsham wrote: >> >> You replied to someone discussing using Haskell at a CDN to implement >> things like web servers by saying that Haskell wasn't suitable for >> the task. > > > That is incorrect. I repli

Re: [Haskell-cafe] "Inconsistency" in support for phantom types?

2009-01-08 Thread David Menendez
On Thu, Jan 8, 2009 at 3:11 PM, DavidA wrote: > Hi, > > I have run into what appears to be an inconsistency in the support for using > phantom types to parameterize other types. Here's an example (don't pay too > much > attention to the maths, it's just there to motivate the example). I want to >

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John Goerzen
On Thu, Jan 08, 2009 at 10:36:32AM -0700, John A. De Goes wrote: > > The number of applications requiring the implementation of a custom web > server is an insignificant fraction of the number of applications > requiring a messaging system. I don't think anyone would dispute > Haskell's abilit

Re: [Haskell-cafe] "Inconsistency" in support for phantom types?

2009-01-08 Thread Jonathan Cast
On Thu, 2009-01-08 at 20:11 +, DavidA wrote: > Hi, > > I have run into what appears to be an inconsistency in the support for using > phantom types to parameterize other types. Here's an example (don't pay too > much > attention to the maths, it's just there to motivate the example). I want t

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Tim Newsham
On Jan 8, 2009, at 12:56 PM, Tim Newsham wrote: You replied to someone discussing using Haskell at a CDN to implement things like web servers by saying that Haskell wasn't suitable for the task. That is incorrect. I replied to Achim's message asking for elaboration on Haskell's unsuitability.

Re: [Haskell-cafe] "Inconsistency" in support for phantom types?

2009-01-08 Thread Miguel Mitrofanov
On 8 Jan 2009, at 23:11, DavidA wrote: inv :: IntegerAsType n => Fp n -> Fp n ^ ^ ^ this "n" --+---+---| inv 0 = error "Fp,inv 0" inv (Fp x) = let p = value (undefined :: n) ^ and this one

Re: [Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread Manlio Perillo
Don Stewart ha scritto: manlio_perillo: Tony Hannan ha scritto: Let me give you more information about this hypothetical job posting. Our company is a startup CDN (http://en.wikipedia.org/wiki/Content_Delivery_Network) about 3 years old and doing well. You would hythothetically be one of 7 pr

[Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann
GHC accepts a class declaration like class Monad (m Maybe) => C m where ... without having any language extension switched on. But it isn't Haskell 98, is it? Hugs 2005 also accepts this. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Manlio Perillo
John Goerzen ha scritto: On Thu, Jan 08, 2009 at 10:36:32AM -0700, John A. De Goes wrote: [...] On the other hand, I see nothing in Haskell that would prevent its use for any of your purposes. There are numerous high-level web infrastructures already. Perhaps they are more or less suited to yo

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Ross Paterson
On Thu, Jan 08, 2009 at 09:59:19PM +0100, Henning Thielemann wrote: > > GHC accepts a class declaration like > class Monad (m Maybe) => C m where > ... > without having any language extension switched on. But it isn't Haskell > 98, is it? Hugs 2005 also accepts this. Yes, it is. The Rep

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Miguel Mitrofanov
On 8 Jan 2009, at 23:59, Henning Thielemann wrote: GHC accepts a class declaration like class Monad (m Maybe) => C m where ... without having any language extension switched on. But it isn't Haskell 98, is it? It is. From Report: A class assertion has form

Re: [Haskell-cafe] Re: How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Lennart Augustsson
Using StableName is really a last resort when you need to do low level strange things. I would not use it when there's another way. Which there is. -- Lennart 2009/1/8 minh thu : > Interestingly, I failed to detect sharing with StableName. > But using the graph node as a key turned to work...

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann
On Fri, 9 Jan 2009, Miguel Mitrofanov wrote: On 8 Jan 2009, at 23:59, Henning Thielemann wrote: GHC accepts a class declaration like class Monad (m Maybe) => C m where ... without having any language extension switched on. But it isn't Haskell 98, is it? It is. From Report: =

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann
On Thu, 8 Jan 2009, Henning Thielemann wrote: On Fri, 9 Jan 2009, Miguel Mitrofanov wrote: On 8 Jan 2009, at 23:59, Henning Thielemann wrote: GHC accepts a class declaration like class Monad (m Maybe) => C m where ... without having any language extension switched on. But it isn't Haske

[Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Bardur Arantsson
Manlio Perillo wrote: John Goerzen ha scritto: On Thu, Jan 08, 2009 at 10:36:32AM -0700, John A. De Goes wrote: [...] On the other hand, I see nothing in Haskell that would prevent its use for any of your purposes. There are numerous high-level web infrastructures already. Perhaps they are mo

Re: [Haskell-cafe] State Monad - using the updated state

2009-01-08 Thread Luke Palmer
On Thu, Jan 8, 2009 at 12:56 PM, Phil wrote: > One more question on this - the other concern I had with the recursive list > approach was that although lazy evaluation prevents me generating numbers > before I 'ask' for them, I figured that if I was going to be asking for say > 10 million over th

Re: [Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread Henning Thielemann
On Thu, 8 Jan 2009, Manlio Perillo wrote: Personally, I only know http://hpaste.org/, based on Server: HAppS/0.8.4 I'm using a modified HWS for the parallel webs, e.g. the Real Monad Transformer: http://www.haskell.org.monadtransformer.parallelnetz.de/haskellwiki/Category:Monad However,

Re: [Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John Van Enk
> PortNum is specified in network byte order and lacking a function to convert host->network byte order (hton). Perhaps this is another argument for my thread from a while back? http://www.nabble.com/Missing-Network-Functions-td21188779.html /jve On Thu, Jan 8, 2009 at 4:37 PM, Bardur Arantsson

Re: [Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John Goerzen
On Thu, Jan 08, 2009 at 10:37:55PM +0100, Bardur Arantsson wrote: > Don't get me wrong -- the socket support is pretty decent, but there are > also some weird idiosyncrasies, for example requiring that the PortNum > is specified in network byte order and lacking a function to convert > host->

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John Goerzen
On Thu, Jan 08, 2009 at 11:14:18AM -0700, John A. De Goes wrote: > But really, what's the point? FFI code is fragile, often uncompilable > and unsupported, and doesn't observe the idioms of Haskell nor take > advantage of its powerful language features. Rather than coding through That is an e

[Haskell-cafe] Monads aren't evil

2009-01-08 Thread Ertugrul Soeylemez
Hello fellow Haskellers, When I read questions from Haskell beginners, it somehow seems like they try to avoid monads and view them as a last resort, if there is no easy non-monadic way. I'm really sure that the cause for this is that most tutorials deal with monads very sparingly and mostly in t

Re: [Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread John Goerzen
On Thu, Jan 08, 2009 at 09:46:36PM +0100, Manlio Perillo wrote: > I'm speaking about servers, not clients. > > How much of pure Haskell internet servers are used in a production > environment, in the "open internet" (and not in restricted LANs)? Does that really matter? I tend to judge technolo

[Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Bardur Arantsson
John Goerzen wrote: On Thu, Jan 08, 2009 at 10:37:55PM +0100, Bardur Arantsson wrote: Don't get me wrong -- the socket support is pretty decent, but there are also some weird idiosyncrasies, for example requiring that the PortNum is specified in network byte order and lacking a function to co

Re: [Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Henning Thielemann
On Thu, 8 Jan 2009, Bardur Arantsson wrote: Thanks. For some reason I hadn't thought to use (fromIntegral x)::PortNumber I guess I got stuck on the idea of constructing a PortNum directly and didn't think beyond that. (Maybe PortNum should really be an abstract type to force indirect cons

[Haskell-cafe] Low-level networking [Haskell not ready for Foo]

2009-01-08 Thread Andrew Coppin
John Goerzen wrote: On Thu, Jan 08, 2009 at 10:36:32AM -0700, John A. De Goes wrote: The number of applications requiring the implementation of a custom web server is an insignificant fraction of the number of applications requiring a messaging system. I don't think anyone would dispute H

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Austin Seipp
Excerpts from John A. De Goes's message of Thu Jan 08 12:14:18 -0600 2009: > But really, what's the point? FFI code is fragile, often uncompilable > and unsupported, and doesn't observe the idioms of Haskell nor take > advantage of its powerful language features. This is a completely unfair ge

Re: [Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread John Goerzen
Bardur Arantsson wrote: > Thanks. For some reason I hadn't thought to use > > (fromIntegral x)::PortNumber > > I guess I got stuck on the idea of constructing a PortNum directly and > didn't think beyond that. (Maybe PortNum should really be an abstract No problem. I knew exactly what you

[Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread Bardur Arantsson
John Goerzen wrote: On Thu, Jan 08, 2009 at 09:46:36PM +0100, Manlio Perillo wrote: I'm speaking about servers, not clients. Personally, I only know http://hpaste.org/, based on Server: HAppS/0.8.4 Take a look at Hackage. There are quite a few other Haskell web frameworks as well: everyth

Re: [Haskell-cafe] Low-level networking [Haskell not ready for Foo]

2009-01-08 Thread John Goerzen
Andrew Coppin wrote: > John Goerzen wrote: >> On Thu, Jan 08, 2009 at 10:36:32AM -0700, John A. De Goes wrote: >> >>> The number of applications requiring the implementation of a custom web >>> server is an insignificant fraction of the number of applications >>> requiring a messaging system.

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Bryan O'Sullivan
On Thu, Jan 8, 2009 at 10:06 AM, Don Stewart wrote: > Note that there even exists an FFI binding to Erlang for Haskell, so > that Haskell nodes can seamlessly interact with other nodes speaking > Erlang's protocol format. > Actually, the erlang package doesn't use the FFI: it speaks the Erlang w

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Sterling Clover
On Thu, Jan 08, 2009 at 11:14:18AM -0700, John A. De Goes wrote: But really, what's the point? FFI code is fragile, often uncompilable and unsupported, and doesn't observe the idioms of Haskell nor take advantage of its powerful language features. Rather than coding through Just for clari

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Bryan O'Sullivan
On Thu, Jan 8, 2009 at 1:07 PM, Manlio Perillo wrote: > Another example is the multipart parser: > > -- | Read a multi-part message from a 'Handle'. > -- Fails on parse errors. > hGetMultipartBody :: String -- ^ Boundary > -> Handle > -> IO MultiPart > hGetMult

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Ross Paterson
On Thu, Jan 08, 2009 at 10:27:59PM +0100, Henning Thielemann wrote: > A nice. I jumped into 4.3 and found > > scontext -> simpleclass > | (simpleclass_1, ..., simpleclass_n) > > simpleclass -> qtycls tyvar > > So it must be 'atype' instead of 'tyvar'? Haskell 98 is really mighty. Oh. Don

Re: [Haskell-cafe] HookedBuildInfo and Cabal

2009-01-08 Thread Duncan Coutts
On Thu, 2009-01-08 at 12:42 -0600, John Goerzen wrote: > As a more general question, how can one use Cabal to detect PostgreSQL > paths in a way that works with both GHC 6.8 and 6.10? Yes: The following is using "build-type: Simple" in HDBC-postgresql.cabal and it does not use HDBC-postgresql.bu

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Miguel Mitrofanov
On 9 Jan 2009, at 02:47, Ross Paterson wrote: On Thu, Jan 08, 2009 at 10:27:59PM +0100, Henning Thielemann wrote: A nice. I jumped into 4.3 and found scontext -> simpleclass | (simpleclass_1, ..., simpleclass_n) simpleclass -> qtycls tyvar So it must be 'atype' instead of 'tyvar'? H

Re: [Haskell-cafe] Staged evaluation, names?

2009-01-08 Thread Henning Thielemann
wren ng thornton schrieb: > Every now and then I find myself in the position where I'd like to > define some hairy value as a CAF instead of a literal, but I'd like for > it to be fully evaluated at compile-time rather than postponed until > runtime. It'd be possible to bludgeon the CPP into doing

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann
On Fri, 9 Jan 2009, Miguel Mitrofanov wrote: On 9 Jan 2009, at 02:47, Ross Paterson wrote: On Thu, Jan 08, 2009 at 10:27:59PM +0100, Henning Thielemann wrote: A nice. I jumped into 4.3 and found scontext -> simpleclass | (simpleclass_1, ..., simpleclass_n) simpleclass -> qtycls tyva

Re: [Haskell-cafe] Staged evaluation, names?

2009-01-08 Thread Andrea Vezzosi
On Thu, Jan 8, 2009 at 5:25 AM, wren ng thornton wrote: > > The question for y'all is what should I call it? I've been calling the > template-function qaf (for Compiled Applicative Form ;) and the type class > with that function would be the only thing in the package, but I'm not sure > where Q

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Tony Hannan
That's great to hear Bryan. I look forward to all of your projects you just mentioned, and work from others like you said, so one day soon we can built really high-performance web servers in elegant Haskell code. I also like Reactive (or FRP in general) as a declarative alternative to message pass

Re: [Haskell-cafe] Taking Exception to Exceptions

2009-01-08 Thread Henning Thielemann
Immanuel Litzroth schrieb: > Anyway, there is one more problem I have related to exceptions that is > about forcing strictness. It relates to option parsing. I have an option -t > that says which track from a file of tracks to print. So I go > > data Flags = TrackNumber !Int deriving(Read, Show,

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Ross Paterson
On Fri, Jan 09, 2009 at 01:11:12AM +0100, Henning Thielemann wrote: > Maybe the report is not complete? I mean, the current behaviour of Hugs > and GHC (as I observed it) is more consistent, and maybe that's what the > designers had in mind. I'm puzzled by the Hugs behaviour. The current vers

Re: [Haskell-cafe] Low-level networking [Haskell not ready for Foo]

2009-01-08 Thread Thomas DuBuisson
Not all the data structures you need are there last I looked. As you could infer from my recent posts, one of my dozen future projects is to add netinet/*.h like data structures to the Haskell network library (i.e. TCP, IPv4, UDP headers with Binary instances). This isn't to say your task would b

Re: [Haskell-cafe] advanced class constraints in Haskell 98?

2009-01-08 Thread Henning Thielemann
On Fri, 9 Jan 2009, Ross Paterson wrote: On Fri, Jan 09, 2009 at 01:11:12AM +0100, Henning Thielemann wrote: Maybe the report is not complete? I mean, the current behaviour of Hugs and GHC (as I observed it) is more consistent, and maybe that's what the designers had in mind. I'm puzzled by

[Haskell-cafe] ANNOUNCE: haskell-src-exts 0.4.8

2009-01-08 Thread Niklas Broberg
Fellow Haskelleers, it is my pleasure to announce the new release of the haskell-src-exts package, version 0.4.8: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskell-src-exts-0.4.8 darcs get http://code.haskell.org/HSP/haskell-src-exts This is a bug-fix release in the wake of the

[Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread Tony Hannan
Well, I received 20 responses in 24 hours, many who would move from abroad to New York! I am very pleased with this number. Hopefully this will ease my boss's concern. But please continue to reply to me if you would be interested and haven't done so yet. The higher the number the more convincing th

Re: [Haskell-cafe] ANNOUNCE: haskell-src-exts 0.4.8

2009-01-08 Thread Max Rabkin
On Thu, Jan 8, 2009 at 4:51 PM, Niklas Broberg wrote: > So unless someone can > point out a good Unicode-aware editor for Windows, I'm afraid this is > a feature that won't be implemented. A Windows port of a Unix editor? I know Vim is available on Windows. Otherwise, Notepad++ appears to have U

[Haskell-cafe] Re: State Monad - using the updated state

2009-01-08 Thread John Lato
It sounds like you've got the monadic solution figured out, so that's good. Even though I would recommend using State (or StateT if necessary), I wanted to be sure this question was answered. > ranq1List :: (Word64 -> a ) -> Word64 -> [a] > ranq1List converter state = converter newState : ranq1Li

Re: [Haskell-cafe] Re: Blitting one IOUArray into another

2009-01-08 Thread Ryan Ingram
You can't safely convert an IOUArray into a Ptr; Ptr is a raw value which isn't noticed by the garbage collector, so if the data is relocated or GC'd while you have a pointer to it, further access will corrupt memory. Rather, the data inside of an IOUArray is held in a MutableByteArray#. In Data.

Re: [Haskell-cafe] Re: How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Ryan Ingram
I seem to recall reading somewhere that an object's StableName can change when it becomes evaluated; so it's possible you aren't detecting sharing because of this. You might try this instead: > mkStableName' a = mkStableName $! a This forces the object to become evaluated before calling mkStable

[Haskell-cafe] Re: Monads aren't evil

2009-01-08 Thread Neal Alexander
Ertugrul Soeylemez wrote: Hello fellow Haskellers, When I read questions from Haskell beginners, it somehow seems like they try to avoid monads and view them as a last resort, if there is no easy non-monadic way. I'm really sure that the cause for this is that most tutorials deal with monads ve

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Timothy Goddard
On Thu, 08 Jan 2009 21:28:27 minh thu wrote: > Hi, > > I'd like to process some kind of graph data structure, > say something like > > data DS = A [DS] | B DS DS | C. Graphs in funtional languages aren't usually represented in this sort of manner. Trees are fine to represent like that as they're

  1   2   >