Re: [Haskell-cafe] The Layout Rule

2012-06-21 Thread Tillmann Rendel
Hi Michael, Michael D. Adams wrote: I am looking for background material on how GHC and other Haskell compilers implement the layout rule. In the context of our work on syntactic extensibility, we have implemented a declarative and extensible mechanism to specify and implement layout rules.

[Haskell-cafe] Why does Enum succ and pred functions throw exception

2012-06-21 Thread Rouan van Dalen
Hi everyone, Can anyone shed some light on why the succ and pred functions of the Enum typeclass throw exceptions if we go over the upper or lower boundary, and not return Maybe a? I was hoping to have some functions like:   safeSucc :: (Enum a) = a - Maybe a Because the succ and pred

Re: [Haskell-cafe] Why does Enum succ and pred functions throw exception

2012-06-21 Thread Francesco Mazzoli
At Thu, 21 Jun 2012 10:11:24 +0100 (BST), Rouan van Dalen wrote: Hi everyone, Can anyone shed some light on why the succ and pred functions of the Enum typeclass throw exceptions if we go over the upper or lower boundary, and not return Maybe a? I was hoping to have some functions like:

Re: [Haskell-cafe] [Haskell] ANNOUNCE: set-monad

2012-06-21 Thread George Giorgidze
Hi Derek, Thanks for providing the executable example that demonstrates your point. It is an interesting one. See my response below. I think it takes us into the discussion as to what constitutes reasonable/law abiding instances of Eq and Ord and what client code that uses Eq and Ord instances

Re: [Haskell-cafe] [Haskell] JustHub 'Sherkin' Release

2012-06-21 Thread Chris Dornan
Does Hub know about system-level libraries that Haskell packages need to build, like Gtk, ADNS, Avahi, etc.? As is the case for cabal-install, ensuring the right system libraries are installed is outside its scope. Chris ___ Haskell-Cafe mailing

Re: [Haskell-cafe] [Haskell] ANNOUNCE: set-monad

2012-06-21 Thread George Giorgidze
Hi Dan, On 21 June 2012 04:21, Dan Burton danburton.em...@gmail.com wrote: Hi George, I didn't have access to my computer over the weekend, so I apologize for not actually running the examples I provided. I was simply projecting what I thought could reasonably be assumed about the behavior

Re: [Haskell-cafe] [Haskell] ANNOUNCE: set-monad

2012-06-21 Thread Alexander Solla
On Thu, Jun 21, 2012 at 7:00 AM, George Giorgidze giorgi...@gmail.comwrote: Regarding antisymmetry, if I also define instance Ord Foo where (==) = (==) `on` a then would that count as satisfying the law? Probably, you mean here Eq instead of Ord. If a = b and b = a then a = b

Re: [Haskell-cafe] The use of continuation monad in C++

2012-06-21 Thread Heinrich Apfelmus
Bartosz Milewski wrote: I published a blog for C++ programmers about the advantages of using the continuation monad in dealing with asynchronous API, concurrency, and parallelism. I explained the concepts in Haskell and the translated them into C++.

Re: [Haskell-cafe] Why does Enum succ and pred functions throw exception

2012-06-21 Thread Brandon Allbery
On Thu, Jun 21, 2012 at 5:11 AM, Rouan van Dalen rvda...@yahoo.co.ukwrote: Can anyone shed some light on why the succ and pred functions of the Enum typeclass throw exceptions if we go over the upper or lower boundary, and not return Maybe a? Enum and Bounded have a complicated and arguably

[Haskell-cafe] Cannot System,Timeout.timeout Network.accept

2012-06-21 Thread Daniel Hlynskyi
Hello Cafe. I cannot accept socket connection with timeout (Windows, GHC 7.4,1). Consider following code: import Network import System.Timeout main = withSocketsDo $ do print :: Starting server ... sock - listenOn (PortNumber 4010) res - timeout 1 (accept sock) print Timed

Re: [Haskell-cafe] Cannot System,Timeout.timeout Network.accept

2012-06-21 Thread Johan Tibell
Some functions in the network package are: NOTE: blocking on Windows unless you compile with -threaded (see GHC ticket #1129) This note does appear next to 'accept', but could you try to compile with -threaded and see if that makes a difference? -- Johan

Re: [Haskell-cafe] The use of continuation monad in C++

2012-06-21 Thread damodar kulkarni
Hello, Thanks for the post. It was very useful to me in getting some insight into this set of concepts. Also your others posts on C++ and FP are very useful. Damodar On Thu, Jun 21, 2012 at 1:17 AM, Bartosz Milewski bart...@fpcomplete.comwrote: I published a blog for C++ programmers about the

Re: [Haskell-cafe] ANNOUNCE: set-monad

2012-06-21 Thread George Giorgidze
Hi Tillmann, Thanks for your interesting question regarding the performance overheads of the Data.Set.Monad wrapper compared to the original Data.Set library. If you use set-specific functions there will not be any difference in asymptotic complexity between Data.Set.Monad and Data.Set. In

Re: [Haskell-cafe] ByteString.getContents fails for files 2GB on OS X

2012-06-21 Thread Shaun Jackman
System.IO.MMap (mmapFileByteString) worked like a charm in loading files larger than 2 GB on OS X. Using mmapFileByteString and strict ByteString is roughly seven times faster for my program than using getContents and ByteString.Lazy. Cheers, Shaun On 11 June 2012 07:08, Gracjan Polak

Re: [Haskell-cafe] Why does Enum succ and pred functions throw exception

2012-06-21 Thread Richard O'Keefe
On 21/06/2012, at 9:11 PM, Rouan van Dalen wrote: I was hoping to have some functions like: safeSucc :: (Enum a) = a - Maybe a Types that are instances of Enum don't necessarily have bounds. It always struck me as odd that Enum doesn't extend Ord. There's a reason given for not having

Re: [Haskell-cafe] The use of continuation monad in C++

2012-06-21 Thread Bartosz Milewski
It's an interesting approach. Your Then constructor maps to my Bind object more naturally than = does. The main reason for using objects rather than functions (closures) in C++ is that the compiler may be able to optimize/inline more code. Closures are not first class citizens in C++ -- they

Re: [Haskell-cafe] [Haskell] ANNOUNCE: set-monad

2012-06-21 Thread Derek Elkins
On Thu, Jun 21, 2012 at 8:30 AM, George Giorgidze giorgi...@gmail.com wrote: Hi Derek, Thanks for providing the executable example that demonstrates your point. It is an interesting one. See my response below. I think it takes us into the discussion as to what constitutes reasonable/law

[Haskell-cafe] Why does (++ !) bla return bla! and not !bla?

2012-06-21 Thread Hilco Wijbenga
Hi all, I'm going through the excellent http://learnyouahaskell.com tutorial. So far it's been pretty easy to follow but now I ran into something that (when I later started reading about maps) do not seem to fully grasp. I think I'm close to understanding why (++ !) bla returns bla! instead of

Re: [Haskell-cafe] Why does (++ !) bla return bla! and not !bla?

2012-06-21 Thread Conrad Parker
On 22 June 2012 12:54, Hilco Wijbenga hilco.wijbe...@gmail.com wrote: Hi all, I'm going through the excellent http://learnyouahaskell.com tutorial. So far it's been pretty easy to follow but now I ran into something that (when I later started reading about maps) do not seem to fully grasp.

Re: [Haskell-cafe] Why does (++ !) bla return bla! and not !bla?

2012-06-21 Thread Peter Gammie
Hilco, On 22/06/2012, at 2:54 PM, Hilco Wijbenga wrote: I'm going through the excellent http://learnyouahaskell.com tutorial. So far it's been pretty easy to follow but now I ran into something that (when I later started reading about maps) do not seem to fully grasp. I think I'm close to

Re: [Haskell-cafe] Why does (++ !) bla return bla! and not !bla?

2012-06-21 Thread Brandon Allbery
On Fri, Jun 22, 2012 at 12:54 AM, Hilco Wijbenga hilco.wijbe...@gmail.comwrote: I think I'm close to understanding why (++ !) bla returns bla! instead of !bla but I seem to be missing the last step. :-) I noticed that ((++) !) bla does indeed return !bla. So it seems to be related to the

Re: [Haskell-cafe] Why does (++ !) bla return bla! and not !bla?

2012-06-21 Thread Hilco Wijbenga
On 21 June 2012 22:04, Peter Gammie pete...@gmail.com wrote: Hilco, On 22/06/2012, at 2:54 PM, Hilco Wijbenga wrote: I'm going through the excellent http://learnyouahaskell.com tutorial. So far it's been pretty easy to follow but now I ran into something that (when I later started reading