Re: [Haskell-cafe] The Typeable class is changing

2011-07-11 Thread dm-list-haskell-cafe
At Mon, 11 Jul 2011 21:18:30 +0300, Yitzchak Gale wrote: Please respond to this thread if you own a package that will be affected by this change. iterIO uses mkTyCon for the simple reason that ((Typeable t, Typeable m) = Iter t m) is Typeable1 and there is no automatic way of deriving

Re: [Haskell-cafe] IterIO: How to write use my inumReverse

2011-07-04 Thread dm-list-haskell-cafe
At Mon, 4 Jul 2011 20:36:33 +1000, John Ky wrote: Hi Haskell Cafe,       enum |$ inumLines .| inumReverse .| inumUnlines .| iter ... iterLines :: (Monad m) = Iter L.ByteString m [L.ByteString] iterLines = do   line - lineI   return [line] iterUnlines

Re: [Haskell-cafe] Strange context reduction with partial application and casting

2011-07-03 Thread dm-list-haskell-cafe
At Sat, 2 Jul 2011 17:23:50 -0400, Brent Yorgey wrote: On Sat, Jul 02, 2011 at 09:02:13PM +0200, Daniel Fischer wrote: - disabling the monomorphism restriction :set -XNoMonomorphismRestriction let g = f This is the recommended solution. The confusion caused by the MR far outweighs

Re: [Haskell-cafe] Patterns for processing large but finite streams

2011-07-01 Thread dm-list-haskell-cafe
At Fri, 1 Jul 2011 09:39:32 +0400, Eugene Kirpichov wrote: Hi, I'm rewriting timeplot to avoid holding the whole input in memory, and naturally a problem arises: How to represent large but finite streams and functions that process them, returning other streams or some kinds of aggregate

Re: [Haskell-cafe] Confused about my IterIO code

2011-06-30 Thread dm-list-haskell-cafe
At Thu, 30 Jun 2011 23:53:02 +1000, John Ky wrote: But all I've done is: enum |$ inumReverseLines .| iter inumReverseLines = mkInum $ do   line - lineI   return (L.reverse (L.concat [line, C.pack \n])) mkInum repeatedly invokes its iter argument so as to keep

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 import

Re: [Haskell-cafe] IterIO type restricted functions

2011-06-28 Thread dm-list-haskell-cafe
At Wed, 29 Jun 2011 10:11:26 +1000, John Ky wrote: [1 multipart/alternative (7bit)] [1.1 text/plain; ISO-8859-1 (7bit)] Hi all, From the IterIO tutorial: enumFile' is like enumFile above, but type restricted to data in the lazy ByteString format, which is more efficient

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-26 Thread dm-list-haskell-cafe
At Sun, 26 Jun 2011 01:41:01 +0100, Paterson, Ross wrote: I thought no type signature meant no type signature inside b1. No, it means no type signature for the variable. Otherwise, you are saying nothing could depend on a binding with a type signature. By that logic, there can be no

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-26 Thread dm-list-haskell-cafe
At Sun, 26 Jun 2011 09:31:05 +0100, Paterson, Ross wrote: Indeed, the Report has two problems: Sections 4.4.3.2 and 4.5.5 have different definitions of simple pattern. This has been there since section 4.5.5 (Monomorphism Restriction) was added in Haskell 1.1. But then the only technical

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-26 Thread dm-list-haskell-cafe
At Sun, 26 Jun 2011 21:15:06 +0100, Paterson, Ross wrote: True. That ambiguity could be avoided by adding the word declaration after type signature. On second thoughts, this is unnecessary. The Report consistently uses expression type signature for the expression and type signature

[Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread dm-list-haskell-cafe
Section 4.4.3.2 of the 2010 Haskell report says: A simple pattern binding has form p = e. The pattern p is matched “lazily” as an irrefutable pattern, as if there were an implicit ~ in front of it. This makes it sound as though p is a pattern, which I assume means what

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread dm-list-haskell-cafe
At Sat, 25 Jun 2011 14:20:52 -0400, Scott Turner wrote: g1 x y z = if xy then show x ++ show z else g2 y x g2 :: (Show a, Ord a) = a - a - String g2 | False = \p q - g1 q p () | otherwise = \p q - g1 q p 'a' where x = True It appears to me that

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread dm-list-haskell-cafe
At Sun, 26 Jun 2011 00:17:12 +0100, Paterson, Ross wrote: g1 x y z = if xy then show x ++ show z else g2 y x g2 :: (Show a, Ord a) = a - a - String g2 | False = \p q - g1 q p () | otherwise = \p q - g1 q p 'a' where x = True It

Re: [Haskell-cafe] Iteratees again (Was: How on Earth Do You Reason about Space?)

2011-06-02 Thread dm-list-haskell-cafe
At Thu, 02 Jun 2011 13:52:52 +0200, Ketil Malde wrote: I have a bunch of old code, parsers etc, which are based on the 'readFile' paradigm: type Str = Data.ByteString.Lazy.Char8.ByteString -- usually decodeFoo :: Str - Foo encodeFoo :: Foo - Str readFoo = decodeFoo . readFile

[Haskell-cafe] Enabling GADTs breaks Rank2Types code compilation - Why?

2011-05-31 Thread dm-list-haskell-cafe
I'm using GHC 7.0.2 and running into a compiler error that I cannot understand. Can anyone shed light on the issue for me? The code does not make use of GADTs and compiles just fine without them. But when I add a {-# LANGUAGE GADTs #-} pragma, it fails to compile. Here is the code: {-#

Re: [Haskell-cafe] Enabling GADTs breaks Rank2Types code compilation - Why?

2011-05-31 Thread dm-list-haskell-cafe
At Tue, 31 May 2011 21:30:01 -0500, austin seipp wrote: The short story is thus: when you turn on GADTs, it also now turns on another extension implicitly (MonoLocalBinds) which restricts let generalization... You can find a little more info about the change here:

Re: [Haskell-cafe] Haskell memory model (was iterIO-0.1)

2011-05-18 Thread dm-list-haskell-cafe
At Wed, 18 May 2011 09:56:22 +0100, Simon Marlow wrote: Ok. I'm not sure how feasible RCU is with IORefs, or even whether it's necessary. After all, the usual pattern of having readers use readIORef while writers use atomicModifyIORef gives the RCU cost model (zero overhead for readers,

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-16 Thread dm-list-haskell-cafe
At Mon, 16 May 2011 10:56:02 +0100, Simon Marlow wrote: Yes, it's not actually documented as far as I know, and we should fix that. But if you think about it, sequential consistency is really the only sensible policy: suppose one processor creates a heap object and writes a reference to

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-16 Thread dm-list-haskell-cafe
At Tue, 17 May 2011 02:18:55 +1000, Bernie Pope wrote: http://augustss.blogspot.com/2011/04/ ugly-memoization-heres-problem-that-i.html He says that There's no guarantee about readIORef and writeIORef when doing multi-threading.. But I was wondering if that was true, and if it were, what

[Haskell-cafe] Haskell memory model (was iterIO-0.1)

2011-05-16 Thread dm-list-haskell-cafe
At Mon, 16 May 2011 22:31:14 +0100, Simon Marlow wrote: Good example - so it looks like we don't get full sequential consistency on x86 (actually I'd been thinking only about write ordering and forgetting that reads could be reordered around writes). But that's bad because it means

Re: [Haskell-cafe] Sending messages up-and-down the iteratee-enumerator chain [Was: iterIO-0.1]

2011-05-13 Thread dm-list-haskell-cafe
At Fri, 13 May 2011 02:57:38 -0700 (PDT), o...@okmij.org wrote: The code described in this message does exactly that. Hey, Oleg. This is really cool! In particular, your Bindable class has the potential to unify a whole bunch of request types and both simplify and generalize code. Also, Sum

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-12 Thread dm-list-haskell-cafe
At Thu, 12 May 2011 16:45:02 +0100, Simon Marlow wrote: There are no locks here, thanks to the message-passing implementation we use for throwTo between processors. Okay, that sounds good. So then there is no guarantee about ordering of throwTo exceptions? That seems like a good

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-11 Thread dm-list-haskell-cafe
At Mon, 9 May 2011 17:55:17 +0100, John Lato wrote: Felipe Almeida Lessa wrote: So, in the enumerator vs. iterIO challenge, the only big differences I see are:  a) iterIO has a different exception handling mechanism.  b) iterIO can have pure iteratees that

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-11 Thread dm-list-haskell-cafe
At Wed, 11 May 2011 13:02:21 +0100, Simon Marlow wrote: There's no guarantee of the form that you mention - asynchronous exceptions can occur anywhere. However, there might be a way to do what you want (disclaimer: I haven't looked at the implementation of iterIO). Control.Exception

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-11 Thread dm-list-haskell-cafe
At Wed, 11 May 2011 13:02:21 +0100, Simon Marlow wrote: There's no guarantee of the form that you mention - asynchronous exceptions can occur anywhere. However, there might be a way to do what you want (disclaimer: I haven't looked at the implementation of iterIO). Control.Exception

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-11 Thread dm-list-haskell-cafe
At Wed, 11 May 2011 13:02:21 +0100, Simon Marlow wrote: However, if there's some simpler way to guarantee that= is the point where exceptions are thrown (and might be the case for GHC in practice), then I basically only need to update the docs. If someone with more GHC understanding

Re: [Haskell-cafe] Type-class conditional behavior

2011-05-08 Thread dm-list-haskell-cafe
At Sat, 7 May 2011 22:14:27 -0700, Nicholas Tung wrote: Dear all,     I'd like to write a function maybeShow :: a - Maybe String, which runs show if its argument is of class Show. You can't do this, because in general there is no way to know whether an arbitrary object a is of class Show.

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-07 Thread dm-list-haskell-cafe
At Sat, 07 May 2011 21:50:13 +0100, Maciej Marcin Piechotka wrote: Sorry for third post but I wonder why the many instances are restricted by Monad. It would be great if Functor were a superclass of Monad. However, since it isn't, and since I can't think of anything particularly useful to do

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread dm-list-haskell-cafe
At Fri, 6 May 2011 10:15:50 +0200, Gregory Collins wrote: Hi David, Re: this comment from catchI: It is not possible to catch asynchronous exceptions, such as lazily evaluated divide-by-zero errors, the throw function, or exceptions raised by other threads using throwTo if those

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread dm-list-haskell-cafe
At Fri, 6 May 2011 10:10:26 -0300, Felipe Almeida Lessa wrote: He also says that the enumerator package's Enumerators aren't iteratees, only iterIO's enumerators are. Well, that's not what I'm reading: -- from enumerator package newtype Iteratee a m b = Iteratee {runIteratee :: m

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread dm-list-haskell-cafe
At Fri, 6 May 2011 10:54:16 -0300, Felipe Almeida Lessa wrote: On Fri, May 6, 2011 at 10:44 AM, Henk-Jan van Tuyl hjgt...@chello.nl wrote: iterIO cannot be compiled on Windows, because it depends on the package unix. That's a big showstopper. I wonder if the package split I recommend

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread dm-list-haskell-cafe
At Sat, 7 May 2011 01:15:25 +1000, Alex Mason wrote: Hi All, I really love the look of this package, but if this is going be *the* iteratee package, I would absolutely love to see it fix some of the biggest mistakes in the other iteratee packages, soecifically naming. A change in naming

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread dm-list-haskell-cafe
At Sat, 07 May 2011 00:09:46 +0200, Henk-Jan van Tuyl wrote: On Fri, May 6, 2011 at 10:44 AM, Henk-Jan van Tuyl hjgt...@chello.nl wrote: iterIO cannot be compiled on Windows, because it depends on the package unix. [...] I'd obviously love to make my stuff work on Windows, but

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-06 Thread dm-list-haskell-cafe
At Fri, 06 May 2011 21:27:21 -0400, Mario Blažević wrote: I'd been thinking about using the terms Source and Sink, but Source is very overloaded, and SinkSource doesn't exactly roll off the tongue or evoke a particularly helpful intuition. The SCC package happens to use Source and