[Haskell-cafe] Zipper and Comonad

2012-05-22 Thread Mathijs Kwik
Hi all, After using zippers for a while, I wanted to dig a bit deeper into them. I found there is some relation between Zipper and Comonad, but this confuses me somewhat. After reading a bit more about Comonads [1] and [2], I think I understand them somewhat, and I see how they too are useful

Re: [Haskell-cafe] ANN: reform - a type-safe form generation and validation library in the spirit of formlets and digestive-functors 0.2

2012-05-22 Thread Jasper Van der Jeugt
Congrats on the release! I would like to help out with the full comparison since I have some knowledge and experience on the subject. Because of the different approach, I think there's definitely room for two libraries. Cheers, Jasper On Tue, May 22, 2012 at 2:23 AM, Felipe Almeida Lessa

[Haskell-cafe] Data.Array.Unboxed in GHC 7.4

2012-05-22 Thread Tom Nielsen
Dear cafe, I have just upgraded to GHC 7.4, and now I run into some compilation problems. Specifically, I have a package that needs both Data.Array.Unboxed and System.IO.Unsafe. But I cannot enable both base and haskell98 in a cabal file. is there any way out of this? If I enable both haskell98

Re: [Haskell-cafe] Data.Array.Unboxed in GHC 7.4

2012-05-22 Thread Tom Nielsen
Apologies, I fixed this. It only affects the really old Array module, which I can live without. Data.Array.Unboxed is fine. Tom On Tue, May 22, 2012 at 10:41 AM, Tom Nielsen taniel...@gmail.com wrote: Dear cafe, I have just upgraded to GHC 7.4, and now I run into some compilation problems.

Re: [Haskell-cafe] Zipper and Comonad

2012-05-22 Thread Conor McBride
Hi Mathijs On 22 May 2012, at 07:42, Mathijs Kwik wrote: Hi all, After using zippers for a while, I wanted to dig a bit deeper into them. I found there is some relation between Zipper and Comonad, but this confuses me somewhat. After reading a bit more about Comonads [1] and [2], I

[Haskell-cafe] Parallel cooperative multithreading?

2012-05-22 Thread Benjamin Ylvisaker
Has anyone ever worked on implementing something like this in Haskell? http://www.cs.hmc.edu/~stone/papers/ocm-unpublished.pdf The outline of the idea: - Concurrent programming is really hard with the popular frameworks today. - For most purposes parallel programming is hard, in some part

[Haskell-cafe] Encoding issues with LDAP package

2012-05-22 Thread Vincent Ambo
Hej, I'm using the LDAP package by John Goerzen to retrieve some information from an Active Directory database. Part of this information are the full names of my company's employees. Many of these names contain characters which aren't part of the standard ASCII set, for example ä å ü ê and so

[Haskell-cafe] Please critique my code (a simple lexer)

2012-05-22 Thread John Simon
Hi all, I've been teaching myself Haskell lately (I come from the C#/Python world). I wrote a simplistic lexer, and I was hoping I could get a code review or two. The code that follows is a stand-alone app that works under GHC. A few concerns of mine: - My `consume` function seems basic enough

Re: [Haskell-cafe] Zipper and Comonad

2012-05-22 Thread Sean Leather
Hi Mathijs, On Tue, May 22, 2012 at 8:42 AM, Mathijs Kwik wrote: After using zippers for a while, I wanted to dig a bit deeper into them. I found there is some relation between Zipper and Comonad, but this confuses me somewhat. You might also take a look at: Comonadic functional attribute

Re: [Haskell-cafe] Please critique my code (a simple lexer)

2012-05-22 Thread Taylor Hedberg
John Simon, Tue 2012-05-22 @ 10:13:07-0500: - My `consume` function seems basic enough that it should be library code, but my searches turned up empty. Did I miss anything? consume = span . flip elem - Is creating data structures with simple field names like `kind`, `offset`, etc a good

Re: [Haskell-cafe] ANN: reform - a type-safe form generation and validation library in the spirit of formlets and digestive-functors 0.2

2012-05-22 Thread Jeremy Shaw
Sounds great! I have some vague ideas about what the comparison might reveal -- but I expect to learn quite a bit in the process, and use that to improve reform. There is definitely room for more than one form validation library. They all have shortcomings, and I am hoping something even better

Re: [Haskell-cafe] Please critique my code (a simple lexer)

2012-05-22 Thread Eric Rasmussen
Another suggestion is to use pattern matching at the function level: doLex' lexer loc [] = [makeToken EOF] doLex' lexer loc (x:xs) = case x of ' ' - more (locInc loc 1) xs '\n'- more (locNL loc) xs ... _ - That saves you from having to deconstruct repeatedly in your

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-22 Thread Isaac Gouy
From: Richard O'Keefe Sent: Monday, May 21, 2012 6:54 PM On 22/05/2012, at 4:15 AM, Isaac Gouy wrote:   Actually, I/O bound is *good*.   Why would that be good or bad? The context here is a UNIX-style topological sorting program. Being I/O bound means that the program is limited by how

[Haskell-cafe] From some High-Performance Computing book; It is hard to eradicate from C++'ers the need for objects, classes, etc. ...

2012-05-22 Thread KC
For high-performance computing you want to avoid such software engineering abstractions as classes, objects, etc Therefore, I would say, since Haskell makes possible many fine-levels of abstraction, if the compiler can strip most of these away, then it would come close to the speed of C (i.e.

Re: [Haskell-cafe] Formalisation for types of monads

2012-05-22 Thread Johannes Waldmann
Ertugrul Söylemez es at ertes.de writes: Note about []: Don't even mention foldl. The folding combinator for lists is foldr, period. Amen. I ignore foldl in teaching but it will appear under the name of IEnumerableT.Aggregate(z, f) (from Linq). Note, the Linq designers got

[Haskell-cafe] (+1) vs let inc=(+1)

2012-05-22 Thread Greg Fitzgerald
In ghci 7.4.1: Prelude :t (+1) (+1) :: Num a = a - a Prelude let inc=(+1) Prelude :t inc inc :: Integer - Integer Why the difference? Thanks, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] (+1) vs let inc=(+1)

2012-05-22 Thread Artyom Kazak
http://www.haskell.org/haskellwiki/Monomorphism_restriction ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] (+1) vs let inc=(+1)

2012-05-22 Thread Sean Leather
On Tue, May 22, 2012 at 9:34 PM, Artyom Kazak wrote: http://www.haskell.org/**haskellwiki/Monomorphism_**restrictionhttp://www.haskell.org/haskellwiki/Monomorphism_restriction + http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluation.html#extended-default-rules

Re: [Haskell-cafe] (+1) vs let inc=(+1)

2012-05-22 Thread Greg Fitzgerald
Thanks! $ ghci -XNoMonomorphismRestriction Prelude :t (+1) (+1) :: Num a = a - a Prelude let inc=(+1) Prelude :t inc inc :: Num a = a - a Cool. -Greg On Tue, May 22, 2012 at 12:34 PM, Artyom Kazak artyom.ka...@gmail.comwrote:

[Haskell-cafe] Haskell Day 2012 (in Japan)

2012-05-22 Thread 山本和彦
Hello Cafe, This is just FYI. We Hasekell community in Japan will have an event called Haskell Day 2012 on 27th May to cerebrate the publication of the Japanese version of Learn you. 180+ people have already registered: # This page is written in Japanese.

Re: [Haskell-cafe] Heads up: importing the Cabal issue tracker to github next week

2012-05-22 Thread Jason Dagit
Thank you. I was trying to register an account on the trac today to file a bug report but the account registration seems to be broken. I'll wait to file my bug till I can use github's much nicer tracker. Thanks, Jason On Wed, May 16, 2012 at 8:45 PM, Bryan O'Sullivan b...@serpentine.comwrote:

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-22 Thread Richard O'Keefe
On 23/05/2012, at 4:54 AM, Isaac Gouy wrote: There may be very little one can do about the I/O part. Maybe you could say how the Java I/O is being done. For 50,000 nodes and 8,385,254 edges, Java (first version) ran out of memory after 89.54 seconds (default heap) Java (2nd

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-22 Thread wren ng thornton
On 5/21/12 10:51 AM, Yves Parès wrote: I do think we have the opposite problem, however, in much Haskell code -- people are using the clean, obviously correct, but inefficient code even in standard library functions that really should be optimized like crazy! And even before optimizing like

Re: [Haskell-cafe] Encoding issues with LDAP package

2012-05-22 Thread wren ng thornton
On 5/22/12 10:30 AM, Vincent Ambo wrote: Hej, I'm using the LDAP package by John Goerzen to retrieve some information from an Active Directory database. Part of this information are the full names of my company's employees. Many of these names contain characters which aren't part of the

Re: [Haskell-cafe] Please critique my code (a simple lexer)

2012-05-22 Thread wren ng thornton
On 5/22/12 11:13 AM, John Simon wrote: - Is `case _ of x:xs - x:xsr where xsr = something xs` a common idiom? It happened twice in my code, and it seems odd to split the first element away from the rest of the list as it's processed. I don't know how common it is in practice, but that's fmap

Re: [Haskell-cafe] Parallel cooperative multithreading?

2012-05-22 Thread Ryan Newton
Personally, I think cooperative concurrency is making a big comeback. Especially in a compiler-supporting form that relies on limited CPS (continuation-passing-style) transformation. There are server and web services applications that motivate it (i.e. in Scala, F# async work flows). In Haskell

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-22 Thread wren ng thornton
On 5/22/12 12:54 PM, Isaac Gouy wrote: On 5/21/2012 6:54 PM, Richard O'Keefe wrote: For 50,000 nodes and 8,385,254 edges, Java (first version) ran out of memory after 89.54 seconds (default heap) Java (2nd version) 13.31 seconds -- avoid Integer boxing! Java (3rd

[Haskell-cafe] vector operations

2012-05-22 Thread Evan Laforge
So I wanted to find the first index in a vector whose running sum is greater than a given number. The straightforward way is to create the running sum and then search: Vector.findIndex (=target) (Vector.scanl' (+) 0 vector) But vectors are strict so it could do extra work, and what if I don't