[Haskell-cafe] Haskell Weekly News: Issue 188

2011-06-29 Thread Daniel Santa Cruz
Welcome to issue 188 of the HWN, a newsletter covering developments in the Haskell community. This release covers the week of June 19 to 25, 2011. It was brought up in cafe this week that some would prefer to see full links in the text version of the mailing list as opposed to the

Re: [Haskell-cafe] [Haskell-beginners] Understanding category theory

2011-06-29 Thread Jack Henahan
Derp, forgot to CC the Cafe. Which ones have you read already? It's difficult to make recommendations without knowing what's already off the table. Additionally, don't be put off if it takes a lot of effort to figure anything out. Math textbooks and so on are unlike any other textbook. It's n

Re: [Haskell-cafe] overloading show function

2011-06-29 Thread Philipp Schneider
Thank you very much, this worked. On 06/30/2011 12:03 AM, aditya siram wrote: > Try enabling OverlappingInstances extension by adding this to the top > of the file: > {-# LANGUAGE OverlappingInstances #-} > > -deech > > On Wed, Jun 29, 2011 at 4:50 PM, Philipp Schneider > wrote: >> Hi cafe, >> >>

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-29 Thread Felipe Almeida Lessa
On Wed, Jun 29, 2011 at 7:11 PM, Gracjan Polak wrote: > Proper way to handle this is probably to add additional Bool parameter to > mkFD, > fdToHandle and GHC.IO.FD.openFile that says if Report's semantics should be > held > or not. Then openFileShared can be build on top of that. > > (Possibly

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-29 Thread Gracjan Polak
Gracjan Polak gmail.com> writes: > > I'm looking for file locking code in GHC.IO.* modules, but cannot find any. > Just for the record: locking code resides in GHC.IO.FD in mkFD which calls lockFile. There is a heavy machinery underneath that is working hard to ensure Report's semantics. Someb

Re: [Haskell-cafe] overloading show function

2011-06-29 Thread Steffen Schuldenzucker
Hi Philipp, On 06/29/2011 11:50 PM, Philipp Schneider wrote: Hi cafe, in my program i use a monad of the following type newtype M a = M (State -> (a, State)) btw., it looks like you just rebuilt the State monad. ... instance (Show a,Show b) => Show (M (a,b)) where show (M f) = let

Re: [Haskell-cafe] overloading show function

2011-06-29 Thread aditya siram
Try enabling OverlappingInstances extension by adding this to the top of the file: {-# LANGUAGE OverlappingInstances #-} -deech On Wed, Jun 29, 2011 at 4:50 PM, Philipp Schneider wrote: > Hi cafe, > > in my program i use a monad of the following type > > newtype M a = M (State -> (a, State)) > >

[Haskell-cafe] overloading show function

2011-06-29 Thread Philipp Schneider
Hi cafe, in my program i use a monad of the following type newtype M a = M (State -> (a, State)) i use the monad in two different ways. The type variable "a" can be a pair as in interp :: Term -> Environment -> M (Value,Environment) and it can be just a value as in type Environment = [(Name,

Re: [Haskell-cafe] How to flush with IterIO in echo server

2011-06-29 Thread dm-list-haskell-cafe
At Wed, 29 Jun 2011 21:13:47 +1000, John Ky wrote: > > Hi Haskell Cafe, > > I've written an echo server using just sockets: > > ... > > When I send text to it, it will echo it back immediately after my newline. > > I then modified it to user IterIO: > > import Control.Concurrent > imp

[Haskell-cafe] hmatrix-static with ghc 7.0.2

2011-06-29 Thread Anand Patil
Hi all, Has anyone managed to get hmatrix-static to compile with ghc 7.0.2, and if so would you be willing to share a patch? With best wishes, Anand ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-

Re: [Haskell-cafe] attoparsec and vectors

2011-06-29 Thread Gregory Collins
On Wed, Jun 29, 2011 at 4:16 AM, Roman Leshchinskiy wrote: > Gregory Collins wrote: >> For an example of a similar technique (minus the freezing part), I did >> a similar thing in the hashtables library: > > You might be interested in 'grow' :-) I would be, except to save a couple of words I use

[Haskell-cafe] How to flush with IterIO in echo server

2011-06-29 Thread John Ky
Hi Haskell Cafe, I've written an echo server using just sockets: import Control.Concurrent import Control.Exception import Control.Monad import Network import Offsync.Data import System.IO import System.IO.Error (isEOFError) main = withSocketsDo $ do sListen <- listenOn (PortNumber 8000) put

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-29 Thread Gracjan Polak
Max Bolingbroke hotmail.com> writes: > http://hackage.haskell.org/packages/archive/unix/2.4.2.0/doc/html/System-Posix-IO.html. Thanks for the link. I tried to use it: Prelude System.Posix.IO> fd1 <- openFd "xxx.tmp" WriteOnly (Just 0666) defaultFileFlags Loading package unix-2.4.0.2 ... linking

Re: [Haskell-cafe] Possible bug in GHC 7.0.3

2011-06-29 Thread Daniel Fischer
On Wednesday 29 June 2011, 11:37:39, Yitzchak Gale wrote: > > So it's the derived Read instance in this context that > is causing the problem. Here is a slightly smaller test > case that triggers the bug: > > {-# LANGUAGE MultiParamTypeClasses, UndecidableInstances #-} > module Bug where > class

Re: [Haskell-cafe] Possible bug in GHC 7.0.3

2011-06-29 Thread Yitzchak Gale
Daniel Fischer wrote: > No, the instance head is just a type variable, not a type constructor > applied to type variables Oops, you're right. GHC was telling the truth, I should have paid closer attention! Fixing my minimal example, I get: {-# LANGUAGE MultiParamTypeClasses, UndecidableInstances

Re: [Haskell-cafe] Possible bug in GHC 7.0.3

2011-06-29 Thread Daniel Fischer
On Wednesday 29 June 2011, 10:22:20, Yitzchak Gale wrote: > Ryan Ingram wrote: > > So this is definitely a GHC bug, but I think the problem is probably > > triggered by this line: > > > > instance Serializable a b => IResource a > > > > I don't think this is a valid instance declaration without

Re: [Haskell-cafe] Possible bug in GHC 7.0.3

2011-06-29 Thread Alberto G. Corona
http://hackage.haskell.org/trac/ghc/ticket/5287 El 29/06/2011 10:22, "Yitzchak Gale" escribió: > Ryan Ingram wrote: >> So this is definitely a GHC bug, but I think the problem is probably >> triggered by this line: >> >> instance Serializable a b => IResource a >> >> I don't think this is a valid

Re: [Haskell-cafe] Possible bug in GHC 7.0.3

2011-06-29 Thread Yitzchak Gale
Ryan Ingram wrote: > So this is definitely a GHC bug, but I think the problem is probably > triggered by this line: > > instance  Serializable a b => IResource a > > I don't think this is a valid instance declaration without a functional > dependency on Serializable, as it's impossible to know whic

Re: [Haskell-cafe] attoparsec and vectors

2011-06-29 Thread Roman Leshchinskiy
Gregory Collins wrote: > On Tue, Jun 28, 2011 at 6:20 PM, Eric Rasmussen > wrote: > >> It runs quickly, but I naively thought I could outperform it by >> reworking "many" to build a vector directly, instead of having to build >> a list first and then convert it to a vector: >> >> manyVec :: Altern

Re: [Haskell-cafe] Possible bug in GHC 7.0.3

2011-06-29 Thread Alberto G. Corona
Ryan' P robably the read instance can not be infered without the functional dependency but the bug is also triggered with it. I simplified ithe coder as much as possible El 29/06/2011 02:26, "Ryan Ingram" escribió: ___ Haskell-Cafe mailing list Haskell-C

Re: [Haskell-cafe] IterIO type restricted functions

2011-06-29 Thread John Ky
Hi David, Good point. Not too fussed, though now that I think about it, I would have preferred it if enumFile' was defined in the tutorial rather than in the module. Cheers, -John On 29 June 2011 13:53, wrote: > At Wed, 29 Jun 2011 10:11:26 +1000, > John Ky wrote: > > > > [1 ] > > [1.1 ] >