Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Patrick Browne
On 22/07/12, Ertugrul Söylemez e...@ertes.de wrote:You are probably confusing the type class system with something fromOOP.  A type class captures a pattern in the way a type is used.  Thecorresponding concrete representation of that pattern is then written inthe instance definition:   No really.

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Alejandro Serrano Mena
I don't know whether this is really applicable but: isn't emptyStack in Ertugrul last message some kind of constructor? You can add any kind of special constructors as functions in the type class which return a new queue. For example: class Stack s where newEmptyStack :: s a newSingletonStack

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-23 Thread Christian Maeder
Am 22.07.2012 17:21, schrieb C K Kashyap: I've updated the parser here - https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/Parsing/xml_3.hs The whole thing is less than 100 lines and it can handle comments as well. This code is still not nice: Duplicate code in openTag and

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Patrick Browne
Yes. I tried that, but due to my lack of Haskell expertise I cannot write the constructor insertC1 below: class QUEUE_SPEC_CLASS1 q where  newC1 :: q a  isEmptyC1 :: q a - Bool  insertC1  :: q a - a - q a  sizeC1    :: q a - Int  restC1    :: q a - q a -- I do not know how to specify

Re: [Haskell-cafe] Haskell's type inference considered harmful

2012-07-23 Thread Andreas Abel
Thanks for your answer and your examples. It would be worthwile collecting such examples in a small article. I think some of the problems with type inference come from insufficient theory about metavariables. When I started studying higher-order unification I always wondered what the scope

Re: [Haskell-cafe] Need help with learning Parsec

2012-07-23 Thread C K Kashyap
Thank you so much Christian for your feedback ... I shall incorporate them. Regards, Kashyap On Mon, Jul 23, 2012 at 3:17 PM, Christian Maeder christian.mae...@dfki.dewrote: Am 22.07.2012 17:21, schrieb C K Kashyap: I've updated the parser here -

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Alejandro Serrano Mena
I think you are confusing ADTs, type classes and default declarations in type classes. In Haskell, values are truly created only via abstract data types. That would be a specific instance of your class: data Stack a = Empty | Top a (Stack a) Then you can write the implementation with respect to

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Dominique Devriese
Patrick, -- Class with functional dependency class QUEUE_SPEC_CLASS2 a q | q - a where newC2 :: q a -- ?? sizeC2 :: q a - Int restC2 :: q a - Maybe (q a) insertC2 :: q a - a - q a The above is a reasonable type class definition for what you seem to intend. -- Without

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Patrick Browne
Dominique,That is exactly the information that I required.Thank you very much,PatOn 23/07/12, Dominique Devriese dominique.devri...@cs.kuleuven.be wrote:Patrick, -- Class with functional dependency class QUEUE_SPEC_CLASS2 a q | q - a where    newC2 :: q a -- ??    sizeC2  :: q a - Int    restC2 

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Ertugrul Söylemez
Patrick Browne patrick.bro...@dit.ie wrote: Thank you for your clear an detailed reply, the work on dependent types seems to address my needs. However it is beyond my current research question, which is quite narrow(see[1]). I merely wish to identify the strengths and weakness of *current

Re: [Haskell-cafe] TLS 0.9.6, question about session resumption.

2012-07-23 Thread Vincent Hanquez
On 07/21/2012 05:12 PM, C Gosch wrote: Hi Cafe, and then the server says (AlertLevel_Fatal,UnexpectedMessage) I'm not sure whether the ServerHelloDone should happen when resuming. Does anyone have a hint what may be going wrong? I am using TLS10 and the tls package with version 0.9.6. Hi

Re: [Haskell-cafe] TLS 0.9.6, question about session resumption.

2012-07-23 Thread .
Thank you Vincent and Dominique, I saw the session callbacks before, and guessed that I needed to store the SessionData for all SessionIDs and return them on resumption (correct me if that's wrong). However, I could not find a module that exports these two data types, so I figured maybe that's

Re: [Haskell-cafe] TLS 0.9.6, question about session resumption.

2012-07-23 Thread .
I just modified TLS locally on my system to export SessionID and SessionData, and set the session callbacks to storing/retrieving the session data from a Map. After that, the resumption appears to work :-D Thanks a lot for that hint! Is that the way it's meant to be? If yes, how do I get the data

[Haskell-cafe] Which ghc binary does ghc-mod use?

2012-07-23 Thread Peter Simons
Hi, I am a happy user of Emacs with ghc-mod for Haskell programming. There is just one issue I've run into: I have multiple versions of GHC installed on my machine. Now, ghc-mod seems to use the GHC binary that was used to compile ghc-mod itself, but that is not the version I want it to use for

Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-07-23 Thread Simon Hengel
On Mon, Jul 23, 2012 at 12:51:32PM -0500, Stephen Paul Weber wrote: Currently you would have to do the upgrade manually, as `cabal-install cabal-install` won't work (or alternatively edit your local ~/.cabl/packages/hackage.haskell.org/00-index.tar). Pending a fix on hackage (hopefully)

Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-07-23 Thread Erik Hesselink
On Monday, July 23, 2012, Simon Hengel wrote: On Mon, Jul 23, 2012 at 12:51:32PM -0500, Stephen Paul Weber wrote: Currently you would have to do the upgrade manually, as `cabal-install cabal-install` won't work (or alternatively edit your local

Re: [Haskell-cafe] TLS 0.9.6, question about session resumption.

2012-07-23 Thread Vincent Hanquez
On 07/23/2012 06:54 PM, . wrote: I just modified TLS locally on my system to export SessionID and SessionData, and set the session callbacks to storing/retrieving the session data from a Map. After that, the resumption appears to work :-D Thanks a lot for that hint! Is that the way it's meant to

Re: [Haskell-cafe] TLS 0.9.6, question about session resumption.

2012-07-23 Thread C Gosch
Nice, thanks!! Christian Am 23.07.2012 um 22:28 schrieb Vincent Hanquez t...@snarc.org: On 07/23/2012 06:54 PM, . wrote: I just modified TLS locally on my system to export SessionID and SessionData, and set the session callbacks to storing/retrieving the session data from a Map. After

Re: [Haskell-cafe] Which ghc binary does ghc-mod use?

2012-07-23 Thread Ivan Lazar Miljenovic
On 24 July 2012 04:06, Peter Simons sim...@cryp.to wrote: Hi, I am a happy user of Emacs with ghc-mod for Haskell programming. There is just one issue I've run into: I have multiple versions of GHC installed on my machine. Now, ghc-mod seems to use the GHC binary that was used to compile

Re: [Haskell-cafe] Which ghc binary does ghc-mod use?

2012-07-23 Thread Brandon Allbery
On Mon, Jul 23, 2012 at 2:06 PM, Peter Simons sim...@cryp.to wrote: I am a happy user of Emacs with ghc-mod for Haskell programming. There is just one issue I've run into: I have multiple versions of GHC installed on my machine. Now, ghc-mod seems to use the GHC binary that was used to

[Haskell-cafe] why does a foldr not have a space leak effect?

2012-07-23 Thread Qi Qi
Hi, I wonder why a foldr does not have a space leak effect? Any hints? Thanks. Qi ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] why does a foldr not have a space leak effect?

2012-07-23 Thread Ivan Lazar Miljenovic
(Trying again using the real mailing list address rather than google groups) On 24 July 2012 12:37, Qi Qi qiqi...@gmail.com wrote: Hi, I wonder why a foldr does not have a space leak effect? Any hints? Thanks. Why should it? Does it not depend on the function you're folding, the type of

Re: [Haskell-cafe] why does a foldr not have a space leak effect?

2012-07-23 Thread Qi Qi
Foldl has the space leak effect, and that's why foldl' has been recommended. On Monday, July 23, 2012 9:44:59 PM UTC-5, Ivan Lazar Miljenovic wrote: (Trying again using the real mailing list address rather than google groups) On 24 July 2012 12:37, Qi Qi qiqi...@gmail.com wrote: Hi,

Re: [Haskell-cafe] why does a foldr not have a space leak effect?

2012-07-23 Thread Ivan Lazar Miljenovic
On 24 July 2012 12:52, Qi Qi qiqi...@gmail.com wrote: Foldl has the space leak effect, and that's why foldl' has been recommended. foldl can have a space leak due to accumulation of thunks: foldl f a [b,c,d] = f (f (f a b) c) d ^^ Building up a chain of functions. As such, these thunks are

Re: [Haskell-cafe] why does a foldr not have a space leak effect?

2012-07-23 Thread Qi Qi
This question actually was risen when I read a relevant part in the RWH book. Now it's much clearer to me. Thanks Ivan! On Monday, July 23, 2012 10:04:00 PM UTC-5, Ivan Lazar Miljenovic wrote: On 24 July 2012 12:52, Qi Qi qiqi...@gmail.com wrote: Foldl has the space leak effect, and that's