Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-26 Thread Henning Thielemann
On Mon, 25 Jul 2011, Manfred Lotz wrote: Hi there, If I take example imap.hs import System.IO import Network.HaskellNet.IMAP import Text.Mime import qualified Data.ByteString.Char8 as BS import Control.Monad -- the next lines were changed to fit to my local imap server imapServer =

[Haskell-cafe] ICFP 2011: Call for participation

2011-07-26 Thread Wouter Swierstra
= Call for Participation The 16th ACM SIGPLAN International Conference on Functional Programming (ICFP 2011) http://www.icfpconference.org/icfp2011/

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-26 Thread Alejandro Serrano Mena
I'll give my two cents about some design I've been thinking about. Instead of trying to derive all instances automatically, the programmer should explicitly tell them (so the problems about conflicting implementations would be minimised). I attach a piece of code of what I think could be done:

[Haskell-cafe] Retaining functions in memory

2011-07-26 Thread Siddhartha Gadgil
      I have been making programs for mathematical applications (low-dimensional topology) in Haskell, which I find a delight to code in. However, the execution is slow, and this seems to be because recursively defined functions seem to be recomputed. For example f(100) needs f(15) which needs

Re: [Haskell-cafe] Retaining functions in memory

2011-07-26 Thread Vo Minh Thu
2011/7/26 Siddhartha Gadgil siddhartha.gad...@gmail.com:       I have been making programs for mathematical applications (low-dimensional topology) in Haskell, which I find a delight to code in. However, the execution is slow, and this seems to be because recursively defined functions seem to

Re: [Haskell-cafe] Retaining functions in memory

2011-07-26 Thread Simon Hengel
I was looking for a way to retain the values of a specific function in memory. Is there some way to do this. Maybe this helps: http://www.haskell.org/haskellwiki/Memoization I haven't read through it, though.. Cheers, Simon ___ Haskell-Cafe mailing

[Haskell-cafe] Effects of Monads in Parallelisation

2011-07-26 Thread Burak Ekici
Dear List, I am currently trying to understand the effects of monads in the sense of parallelisation in Haskell. Could somebody please explain the difference between 'rpar' and 'par'? I mean, what has been changed after the encapsulation of 'par' function by Eval monad? If you asked to

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-26 Thread James Cook
On Jul 25, 2011, at 4:55 PM, Ryan Ingram wrote: My guess is that nobody has put forward a clear enough design that solves all the problems. In particular, orphan instances are tricky. Here's an example: module Prelude where class (Functor m, Applicative m) = Monad m where return

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-26 Thread Victor Nazarov
On Tue, Jul 26, 2011 at 1:01 PM, Alejandro Serrano Mena trup...@gmail.com wrote: I'll give my two cents about some design I've been thinking about. Instead of trying to derive all instances automatically, the programmer should explicitly tell them (so the problems about conflicting

[Haskell-cafe] Fwd: Re: How to select last inserted record from Table Using Database.HSQL.MySQL

2011-07-26 Thread Steffen Schuldenzucker
Forwarding to list Original Message Subject:Re: [Haskell-cafe] How to select last inserted record from Table Using Database.HSQL.MySQL Date: Tue, 26 Jul 2011 14:27:56 +0300 From: Sergiy Nazarenko nazarenko.ser...@gmail.com To: Steffen Schuldenzucker

Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-26 Thread Manfred Lotz
On Tue, 26 Jul 2011 10:17:22 +0200 (CEST) Henning Thielemann lemm...@henning-thielemann.de wrote: On Mon, 25 Jul 2011, Manfred Lotz wrote: Hi there, If I take example imap.hs import System.IO import Network.HaskellNet.IMAP import Text.Mime import qualified

Re: [Haskell-cafe] Effects of Monads in Parallelisation

2011-07-26 Thread David Barbour
2011/7/26 Burak Ekici ekcbu...@hotmail.com what has been changed after the encapsulation of 'par' function by Eval monad? If you asked to compare the parallelisation via monads with non-monadic manner of it, what could you say? 'Eval' provides some useful discipline and structure. It

[Haskell-cafe] Idiomatic ways to make all instances of a certain class also instances of another?

2011-07-26 Thread Tim Cowlishaw
Hi all, I'm currently embarking on my first major project in Haskell, after dabbling with it for several years, and seem to keep finding myself in situations where I create a typeclass that seems to be some sort of specialisation of another, more general typeclass. Given that this is the case,

Re: [Haskell-cafe] Idiomatic ways to make all instances of a certain class also instances of another?

2011-07-26 Thread Stephen Tetley
For: instance (Ord a) = Max a where maximum = max The same could more simply be achieved with a function: maximum :: Ord a = a maximum = max Now, you probably wanted both a base-case using max and type specific, special cases: instance Max Int where maximum = 2^16 If you have both

Re: [Haskell-cafe] Idiomatic ways to make all instances of a certain class also instances of another?

2011-07-26 Thread Evan Laforge
However, I'd be curious to know if (a) There are better or more idiomatic ways of achieving the same effect, and (b) Whether or not I should be doing this at all; It did occur to me that this seems rather trying to re-implement OOP-style inheritance with typeclasses, and therefore perhaps not

[Haskell-cafe] Library for Sparse Vectors?

2011-07-26 Thread dokondr
Hi, Can't find on hackage any sparse vector library. Does such thing exist? I need efficient storage and dot product calculation for very sparse vectors with about 10 out of 40 000 non-zero components. One solution would be to represent Sparse Vector as Data.Map with (component_index,

Re: [Haskell-cafe] Idiomatic ways to make all instances of a certain class also instances of another?

2011-07-26 Thread Tim Cowlishaw
On Tue, Jul 26, 2011 at 7:46 PM, Evan Laforge qdun...@gmail.com wrote: Could you give a specific example of the problem you're trying to solve? Sorry, yes, that'd be useful :-) So, the project I'm working on involves developing a simulation of a securities market. I have a type which models an

Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-26 Thread Donn Cave
Quoth Manfred Lotz manfred.l...@arcor.de, ... I'm not quite sure I understand what you mean. Stack overflow comes from this: forM_ msgs (\x - fetch con x = print) If I change it to: mapM_ (\x - fetch con x = print) msgs there is the same stack overflow. I didn't

Re: [Haskell-cafe] Library for Sparse Vectors?

2011-07-26 Thread Alexander Solla
On Tue, Jul 26, 2011 at 1:30 PM, dokondr doko...@gmail.com wrote: Hi, Can't find on hackage any sparse vector library. Does such thing exist? I need efficient storage and dot product calculation for very sparse vectors with about 10 out of 40 000 non-zero components. One solution would be to

Re: [Haskell-cafe] Idiomatic ways to make all instances of a certain class also instances of another?

2011-07-26 Thread Alexander Solla
On Tue, Jul 26, 2011 at 1:52 PM, Tim Cowlishaw t...@timcowlishaw.co.ukwrote: On Tue, Jul 26, 2011 at 7:46 PM, Evan Laforge qdun...@gmail.com wrote: Could you give a specific example of the problem you're trying to solve? Sorry, yes, that'd be useful :-) So, the project I'm working on

Re: [Haskell-cafe] Library for Sparse Vectors?

2011-07-26 Thread dokondr
Thanks for the detailed reply and example! Using IntMap as a vector seems to be a good idea. In your example: 1) I would use: dot = dot' * dot' dot' = sum . elems . intersectionWith (*) norm = sum . fmap (**2) . elems instead of: dot = sum . elems .

Re: [Haskell-cafe] Idiomatic ways to make all instances of a certain class also instances of another?

2011-07-26 Thread Henning Thielemann
On Tue, 26 Jul 2011, Tim Cowlishaw wrote: For instance, for a typeclass representing the interface that any Order type should implement: class Order o where price :: o - Int size :: o - Int I'd like to be able to specify an Eq instance for all types of class Order in a manner similar to

Re: [Haskell-cafe] Library for Sparse Vectors?

2011-07-26 Thread Henning Thielemann
On Tue, 26 Jul 2011, Alexander Solla wrote: Given two (IntMap Double)s a and b, I would compute the projection of a along b as cosineSimilarity :: IntMap Double - IntMap Double - Double cosineSimilarity a b  = (dot a b) / ((norm a) * (norm b)) where                  dot  = sum . elems .

Re: [Haskell-cafe] Library for Sparse Vectors?

2011-07-26 Thread Henning Thielemann
On Wed, 27 Jul 2011, dokondr wrote: In your example: 1)  I would use: dot = dot' * dot' dot' = sum . elems . intersectionWith (*) norm = sum . fmap (**2) . elems  instead of: dot = sum . elems . intersectionWith (*) norm = (**0.5) . sum . fmap (**2) .

Re: [Haskell-cafe] Library for Sparse Vectors?

2011-07-26 Thread Alexander Solla
On Tue, Jul 26, 2011 at 3:27 PM, dokondr doko...@gmail.com wrote: Thanks for the detailed reply and example! Using IntMap as a vector seems to be a good idea. In your example: 1) I would use: dot = dot' * dot' dot' = sum . elems . intersectionWith (*) norm = sum .

Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-26 Thread Henning Thielemann
On Tue, 26 Jul 2011, Manfred Lotz wrote: main = do s con - connectIMAP imapServer login con user pass mboxes - list con mapM print mboxes This should be mapM_ and 'ghc -Wall' spots this problem since 6.12. The compiler (7.04) doesn't tell me anything about it. It seems that it is

Re: [Haskell-cafe] file splitter with enumerator package

2011-07-26 Thread yi huang
On Tue, Jul 26, 2011 at 12:19 PM, yi huang yi.codepla...@gmail.com wrote: Actually, i'm wondering how to do exception handling and resource cleanup in iteratee, e.g. your `writer` iteratee, i found it difficult, because iteratee is designed to let enumerator manage resources. I've found the

[Haskell-cafe] XCode Dependency for HP on Mac

2011-07-26 Thread Tom Murphy
This may sound ignorant because, well, it is ignorant: I know very little about the underlying mechanics here. Installing the Haskell Platform currently requires XCode developer tools. To get XCode on my 10.6 machine, I... [*** begin ranty details (skippable) ... was told I could get a free

Re: [Haskell-cafe] XCode Dependency for HP on Mac

2011-07-26 Thread Ivan Lazar Miljenovic
On 27 July 2011 13:55, Tom Murphy amin...@gmail.com wrote: This may sound ignorant because, well, it is ignorant: I know very little about the underlying mechanics here. Installing the Haskell Platform currently requires XCode developer tools. To get XCode on my 10.6 machine, I... My

Re: [Haskell-cafe] XCode Dependency for HP on Mac

2011-07-26 Thread Tom Murphy
On 7/27/11, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Installing the Haskell Platform currently requires XCode developer tools. To get XCode on my 10.6 machine, I... My understanding is that it's about $5 (though I seem to recall hearing that they recently made it free), but I

Re: [Haskell-cafe] XCode Dependency for HP on Mac

2011-07-26 Thread Ivan Lazar Miljenovic
On 27 July 2011 14:18, Tom Murphy amin...@gmail.com wrote: On 7/27/11, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Installing the Haskell Platform currently requires XCode developer tools. To get XCode on my 10.6 machine, I... My understanding is that it's about $5 (though I seem

Re: [Haskell-cafe] XCode Dependency for HP on Mac

2011-07-26 Thread Richard O'Keefe
On 27/07/2011, at 4:24 PM, Ivan Lazar Miljenovic wrote: If this is the case, couldn't the HP use gcc instead? I'd personally advocate gcc as standard, not as a workaround, because a) gcc is FOSS. b) XCode is 4GB and its functionality is basically orthogonal to the needs of Haskell

Re: [Haskell-cafe] XCode Dependency for HP on Mac

2011-07-26 Thread Maciej Wos
If you're using Lion you can get Xcode from the App Store (Apple used to charge something for it, but now it is free). If you're using Snow Leopard you can download Xcode from developer.apple.com/xcode. See Looking for Xcode 3? Download Now in the bottom right corner of the page. You need to

Re: [Haskell-cafe] XCode Dependency for HP on Mac

2011-07-26 Thread Arlen Cuss
27/07/2011 3:27 PM, Maciej Wos kirjutas: If you're using Lion you can get Xcode from the App Store (Apple used to charge something for it, but now it is free). If you're using Snow Leopard you can download Xcode from developer.apple.com/xcode. See Looking for Xcode 3? Download Now in the