[Haskell-cafe] Re: understanding enumerator/iteratee

2008-12-23 Thread oleg
Artyom Shalkhakov wrote > I would say that it [iteratee] just tells us how to react to various forms of > input. :) This is much like the function you pass to foldr. Precisely. To sum up all elements of Data.Map, we do Map.fold (+) 0 mp to sum up all elements of a set we do Set.f

Re: [Haskell-cafe] intercalate and (byte)strings

2008-12-23 Thread Neil Mitchell
Hi wman, > -- B == Data.ByteString ; L == Data.ByteString.Lazy > contents' = B.intercalate B.empty $ L.toChunks contents > > with a previously unencountered function intercalate. A quick google query > later i knew that it's just intersperse & concat nicely bundled and started > wondering why anyb

[Haskell-cafe] New Haskell logo contest

2008-12-23 Thread Fritz Ruehr
I think this logo contest is a great idea. I submitted my "classy Haskell" logo from the merch. page, but I have to admit I like some of the other ones on the submission page a whole lot. Hey, *here's* an idea: maybe whoever wins the logo contest has to take over management of the Haskell me

[Haskell-cafe] Parsec question

2008-12-23 Thread Erik de Castro Lopo
Hi all, I'm rather new to Haskell and I'm diving right into the deep end writing a parser using Parsec. In particular I'm using Text.ParserCombinators.Parsec.Language to do some of the heavy lifting and have this: import qualified Text.ParserCombinators.Parsec.Language as L import qual

[Haskell-cafe] Initializing GHC from Python

2008-12-23 Thread Ron de Bruijn
Hi, We have just published a small article on how one can initialize GHC from Python, with only optional use of C. You can read it at http://gamr7.com/blog/?p=65 . Best regards, Ron de Bruijn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Parsec question

2008-12-23 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote: > qualifiedIdentifier :: CharParser st [ String ] Ahh, figured it out myself: qualifiedIdentifier :: CharParser st [ String ] qualifiedIdentifier = do i <- identifier r <- dotIdentifier return (i : r) where

[Haskell-cafe] Re: concurrent haskell: thread priorities

2008-12-23 Thread Neal Alexander
Bulat Ziganshin wrote: Hello Neal, Monday, December 22, 2008, 11:07:32 PM, you wrote: The threaded RT creates an OS thread for each CPU/core on the system and uses them to multiplex userland threads. These are context switched whenever they block/yield/gc and no priorities can be assigned.

RE: [Haskell-cafe] Problems Installing Takusen with Sqlite Backend

2008-12-23 Thread Bayley, Alistair
> From: haskell-cafe-boun...@haskell.org > [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Günther Schmidt > > what does it take to install Takusen on Win32 with Sqlite backend? > > I did manage to install *plain* Takusen via cabal install by > downgrading > to Cabal-1.4 but when I wan

Re: [Haskell-cafe] Problems Installing Takusen with Sqlite Backend

2008-12-23 Thread GŸuenther Schmidt
Thanks Alistair, inspiration had stuck me meanwhile and that's exactly what I did. Günther Bayley, Alistair schrieb: From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Günther Schmidt what does it take to install Takusen on Win32 with Sqlite backend

[Haskell-cafe] Re: Parsec question

2008-12-23 Thread Benedikt Huber
Erik de Castro Lopo schrieb: Erik de Castro Lopo wrote: qualifiedIdentifier :: CharParser st [ String ] Ahh, figured it out myself: qualifiedIdentifier :: CharParser st [ String ] qualifiedIdentifier = do i <- identifier r <- dotIdentifier retu

Re: [Haskell-cafe] Cabal Install & Links to Source from Haddock Docs

2008-12-23 Thread Duncan Coutts
On Mon, 2008-12-22 at 17:58 -0800, R Hayes wrote: > Thank you. As it turns out, I was aware of that recipe. What I > wanted was to be able to use cabal install's nice dependency following > features and still get source links in my documentation. Due to popular demand we quickly added the --

Re: [Haskell-cafe] Re: Parsec question

2008-12-23 Thread Erik de Castro Lopo
Benedikt Huber wrote: > have a look at the module Text.ParserCombinators.Parsec.Combinator. > Those functions should help you to build up parsers from smaller > building blocks. > > Using sepBy1, the above parser can be written as > > dot = T.dot lexer > qualifiedIdentifier = sepBy1 i

Re: [Haskell-cafe] Re: Threads with high CPU usage

2008-12-23 Thread Duncan Coutts
On Tue, 2008-12-23 at 03:56 +0100, wman wrote: > Thanks to you all for inspiration. > > My web app (which otherwise ran ok) was getting stuck while getting > harassed by ab (apache-benchmark) after receiving some 800+ requests > in short succession (not less, never gotten to 900, what was weird >

[Haskell-cafe] What are side effects in Haskell?

2008-12-23 Thread Hans van Thiel
Hello All, I just saw somewhere that one of the purposes of monads is to capture side effects. I understand what a side effect is in C, for example. Say you want to switch the contents of two variables. Then you need a third temporary variable to store an intermediate result. If this is global, th

Re: [Haskell-cafe] [Byte8] <-> ByteString

2008-12-23 Thread Duncan Coutts
On Tue, 2008-12-23 at 00:34 -0600, Galchin, Vasili wrote: > Hello, > > I have been reading through Data->ByteString. What is the is > most elegant and efficient way to map/unmap [Byte8] <-> ByteString? Hoogle is your friend! http://haskell.org/hoogle/ [Word8] -> ByteString http://haskell.

Re: [Haskell-cafe] intercalate and (byte)strings

2008-12-23 Thread Duncan Coutts
On Tue, 2008-12-23 at 05:21 +0100, wman wrote: > I encountered the following code : > > -- B == Data.ByteString ; L == Data.ByteString.Lazy > contents' = B.intercalate B.empty $ L.toChunks contents > > with a previously unencountered function intercalate. A quick google > query later i knew that

Re: [Haskell-cafe] intercalate and (byte)strings

2008-12-23 Thread wman
Thank you, guys, i somehow got the impression that there has to be some meaning to this. It seemed unprobable, but why would anybody write it like that if there weren't some reason to it ? ;-))) Have a nice holidays, btw. Cheers, wman. On Tue, Dec 23, 2008 at 3:21 PM, Duncan Coutts wrote: > O

Re: [Haskell-cafe] What are side effects in Haskell?

2008-12-23 Thread Cristiano Paris
On Tue, Dec 23, 2008 at 3:16 PM, Hans van Thiel wrote: > Hello All, > > I just saw somewhere that one of the purposes of monads is to capture > side effects. I understand what a side effect is in C, for example. Say > you want to switch the contents of two variables. Then you need a third > tempor

[Haskell-cafe] Re: What are side effects in Haskell?

2008-12-23 Thread ChrisK
Hans van Thiel wrote: I just saw somewhere that one of the purposes of monads is to capture side effects. There are a few things that have "side effects". The best way to capture this is to see that there are both (1) commands whose result depends on some external state (2) commands whic

Re: [Haskell-cafe] Stupid question #374: why is MaybeT not in the standard library?

2008-12-23 Thread Antoine Latter
On Tue, Dec 23, 2008 at 12:53 AM, Luke Palmer wrote: > On Mon, Dec 22, 2008 at 6:52 PM, Antoine Latter wrote: >> Although I still had to use my own because I wanted a MonadPlus >> instance. I would offer a patch, but since there's more than one >> useful MonadPlus instance for MaybeT it probably

[Haskell-cafe] cabal, multi-file applications

2008-12-23 Thread Cetin Sert
Hi, I get the following error message: ce...@unique:~/lab/test/qths/hnm$ make configure runhaskell Setup.hs configure Configuring HNM-0.2... ce...@unique:~/lab/test/qths/hnm$ make build runhaskell Setup.hs build Preprocessing library HNM-0.2... Preprocessing executables for HNM-0.2... Building HN

Re: [Haskell-cafe] cabal, multi-file applications

2008-12-23 Thread Gwern Branwen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 2008/12/23 Cetin Sert : > Hi, > > I get the following error message: > > ce...@unique:~/lab/test/qths/hnm$ make configure > runhaskell Setup.hs configure > Configuring HNM-0.2... > ce...@unique:~/lab/test/qths/hnm$ make build > runhaskell Setup.hs bu

Re: [Haskell-cafe] cabal, multi-file applications

2008-12-23 Thread Duncan Coutts
On Tue, 2008-12-23 at 17:27 +0100, Cetin Sert wrote: > when I try to build the following program: > http://sert.homedns.org/hs/hnm/ > http://sert.homedns.org/hs/hnm/hnm.cabal > > How can I tell in my cabal file that wlan.hs should be built first > than settings.hs than demo3.hs? You need to foll

RE: [Haskell-cafe] forkIO on multicore[MESSAGE NOT SCANNED]

2008-12-23 Thread Paul Keir
Hi Duncan, I'm following the story regarding (parallel) GC in this example with interest, but forgive me if I ask a more minor question regarding your modification of an extra parameter, "n", to "heavytask". Does this really help (to ensure that each core does work independently)? Surely, with fib

Re: [Haskell-cafe] Stupid question #374: why is MaybeT not in the standard library?

2008-12-23 Thread Benja Fallenstein
On Tue, Dec 23, 2008 at 2:52 AM, Antoine Latter wrote: > Although I still had to use my own because I wanted a MonadPlus > instance. I would offer a patch, but since there's more than one > useful MonadPlus instance for MaybeT it probably still wouldn't be > right for everyone. Umh, there is a M

Re: [Haskell-cafe] Stupid question #374: why is MaybeT not in the standard library?

2008-12-23 Thread Benja Fallenstein
On Tue, Dec 23, 2008 at 8:05 PM, Benja Fallenstein wrote: > Umh, there is a MonadPlus instance in the package? Ah: ...in the version Cale uploaded two days ago, not in the previous version. Sorrynevermindisee :) - Benja ___ Haskell-Cafe mailing list Ha

[Haskell-cafe] How does one use Text.Regex.Base.RegexLike?

2008-12-23 Thread Lyle Kopnicky
I'm trying to migrate code from using the old Text.Regex to the new Text.Regex.Base. But, I'm getting type errors. I can't even create a regex. Looking at the docs, it seems like this should print "bcd": import Data.Array import Text.Regex.Base import Text.Regex.Posix rx = makeRegex "a(.*)A" Jus

Re: [Haskell-cafe] monad constraint + record update

2008-12-23 Thread Brent Yorgey
On Mon, Dec 22, 2008 at 06:19:07PM +0100, Peter Padawitz wrote: > I'd like to define a monad Set for types in the class Eq. But how can the > arguments of Set be constrained when Set is defined as an instance of > Monad? instance Eq a => Monad Set where ... obviously cannot work. > > Is there a s

Re: [Haskell-cafe] The Haskell re-branding exercise

2008-12-23 Thread Don Stewart
eelco: > On 21 dec 2008, at 22:26, Sebastian Sylvan wrote: > >I am very shortly travelling abroad for several weeks and will not > >have (reliable access to) a computer, but isn't this a task for one > >of the haskell web-apps people (HSP, HAppS, Turbinado, etc.) to show > >us once and for al

Re: [Haskell-cafe] How does one use Text.Regex.Base.RegexLike?

2008-12-23 Thread Jeremy Shaw
Hello, Does this help? http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/ j. At Tue, 23 Dec 2008 11:21:41 -0800, Lyle Kopnicky wrote: > > [1 ] > [1.1 ] > I'm trying to migrate code from using the old Text.Regex to the new > Text.Regex.Base. But, I'm getting typ

Re: [Haskell-cafe] monad constraint + record update

2008-12-23 Thread Brent Yorgey
> > Is there a standard update function for fields in data types, something > that OO programmers do with assignments like obj.attr := value ? Oh, I missed this question the first time. You probably want Functional References: http://twan.home.fmf.nl/blog/haskell/overloading-functional-referenc

Re: [Haskell-cafe] New Haskell logo contest

2008-12-23 Thread Don Stewart
fruehr: > I think this logo contest is a great idea. I submitted my "classy > Haskell" logo from the merch. page, but I have to > admit I like some of the other ones on the submission page a whole lot. > > Hey, *here's* an idea: maybe whoever wins the logo contest has to take > over management

Re: [Haskell-cafe] monad constraint + record update

2008-12-23 Thread Eugene Kirpichov
I think that Conal Elliot's Semantic Editor Combinators do the thing even better: http://conal.net/blog/posts/semantic-editor-combinators/ 2008/12/23 Brent Yorgey : >> >> Is there a standard update function for fields in data types, something >> that OO programmers do with assignments like obj.att

[Haskell-cafe] Re: concurrent haskell: thread priorities

2008-12-23 Thread Neal Alexander
Thomas DuBuisson wrote: It seems like we could get some priority based scheduling (and still be slackers) if we allow marked green threads to be strictly associated with a specific OS thread (forkChildIO?). I think you want the GHC-only GHC.Conc.forkOnIO Suggestions like this are m

Re: [Haskell-cafe] How does one use Text.Regex.Base.RegexLike?

2008-12-23 Thread Lyle Kopnicky
Yes, sort of. It enables me to get some simple examples working with (=~). But I still don't know how to get makeRegex to work. You need it to specify options like case insensitivity, or to use functions like matchAllText. On Tue, Dec 23, 2008 at 11:29 AM, Jeremy Shaw wrote: > Hello, > > Does th

Re: [Haskell-cafe] How does one use Text.Regex.Base.RegexLike?

2008-12-23 Thread Daniel Fischer
Am Dienstag, 23. Dezember 2008 21:09 schrieb Lyle Kopnicky: > Yes, sort of. It enables me to get some simple examples working with (=~). > But I still don't know how to get makeRegex to work. You need it to specify > options like case insensitivity, or to use functions like matchAllText. > Your pr

Re: [Haskell-cafe] How does one use Text.Regex.Base.RegexLike?

2008-12-23 Thread Lyle Kopnicky
Yes, that worked, thanks. I just figured that out too. Here's a whole working program: import Text.Regex.Base import Text.Regex.Posix rx :: Regex rx = makeRegex "a(.*)A" mr = match rx "abcdA" text = head $ mrSubList mr main = putStrLn text On Tue, Dec 23, 2008 at 12:30 PM, Daniel Fischer wro

[Haskell-cafe] hackage, gtk2hs

2008-12-23 Thread Cetin Sert
Hi, A package I want to upload only builds with the unreleased gtk2hs version from the darcs repository and not the latest released version 0.9.13 or any lesser. But the repository version seems to not have changed, so if I say in my cabal file: gtk >= 0.9.14 it does not even build with the gtk2

Re: [Haskell-cafe] understanding enumerator/iteratee

2008-12-23 Thread Henning Thielemann
Jason Dusek schrieb: > I'm taking a stab at composable streams, starting with > cursors. I managed to make a derived cursor today -- as I work > through this stuff, I hope to understand Iteratee/Enumerator > better. How about a wiki page on the roles of enumerators and iteratees, best expl

Re: [Haskell-cafe] Stupid question #374: why is MaybeT not in the standard library?

2008-12-23 Thread Antoine Latter
On Tue, Dec 23, 2008 at 1:08 PM, Benja Fallenstein wrote: > On Tue, Dec 23, 2008 at 8:05 PM, Benja Fallenstein > wrote: >> Umh, there is a MonadPlus instance in the package? > > Ah: ...in the version Cale uploaded two days ago, not in the previous > version. Sorrynevermindisee :) > No, you're ri

Re: [Haskell-cafe] Initializing GHC from Python

2008-12-23 Thread Jason Dusek
I upmodded this on Reddit. Thank you for your work. -- Jason Dusek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] understanding enumerator/iteratee

2008-12-23 Thread Jason Dusek
Henning Thielemann wrote: > Jason Dusek schrieb: > > I'm taking a stab at composable streams, starting with > > cursors. I managed to make a derived cursor today -- as I > > work through this stuff, I hope to understand > > Iteratee/Enumerator better. > > How about a wiki page on the roles of enum

[Haskell-cafe] example editrc

2008-12-23 Thread brian
This is making ghci with editline nicer for me. It says to use the vi key mapping, tab for completion, C-l to clear the screen, and jj to go into vi command mode. $ cat ~/.editrc bind -v bind \\t rl_complete bind ^L ed-clear-screen bind jj vi-command-mode __

Re: [Haskell-cafe] Re: [Haskell] ANN: HLint 1.0

2008-12-23 Thread Claus Reinke
Well, sort of. Ok, we can parse that. Let's assume a variable x holds the output of :show modules as a String. We call lines on it, then map words on it, do a !! 2 on it, and we get ["Util.hs,", "Recorder.hs,", "Game.hs,", "Monadius.hs,", "Demo.hs,"]. Chuck in a map (filter (\= ',')), and we get a

Re: [Haskell-cafe] Re: Parsec question

2008-12-23 Thread Erik de Castro Lopo
Benedikt Huber wrote: > Using sepBy1, the above parser can be written as > > dot = T.dot lexer > qualifiedIdentifier = sepBy1 identifier dot My next problem is matching things like: identifier ('.' identifier)* ('.' '*')? I've had a look at lookAhead from Text.ParserCombinators

Re: [Haskell-cafe] Re: Parsec question

2008-12-23 Thread Toby Hutton
On Wed, Dec 24, 2008 at 9:22 AM, Erik de Castro Lopo wrote: > > My next problem is matching things like: > > identifier ('.' identifier)* ('.' '*')? > > I've had a look at lookAhead from Text.ParserCombinators.Parsec.Combinator > but I can't get it to work. * is analogous to the 'many' combi

Re: [Haskell-cafe] Re: Parsec question

2008-12-23 Thread Erik de Castro Lopo
Toby Hutton wrote: > One of the tricks I found early on is to understand where to use 'try' > (since by default input is consumed even if a parser fails) but apart > from that just read Daan's page, even though it's out of date, and > look at how all these cool combinators work. > > http://legacy

Re: [Haskell-cafe] Re: Detecting system endianness

2008-12-23 Thread wren ng thornton
Maurí­cio wrote: > > But why would you want that? I understand the only > > situation when talking about number of bytes > > makes sense is when you are using Foreign and > > Ptr. (...) > > Because I'm using both Ptr and Foreign? ;) > > See my recent announcement for bytestring-trie. One of the

Re: [Haskell-cafe] What are side effects in Haskell?

2008-12-23 Thread Adrian Neumann
Am 23.12.2008 um 15:16 schrieb Hans van Thiel: Hello All, I just saw somewhere that one of the purposes of monads is to capture side effects. I understand what a side effect is in C, for example. Say you want to switch the contents of two variables. Then you need a third temporary variable

Re: [Haskell-cafe] Is this related to monomorphism restriction?

2008-12-23 Thread wren ng thornton
Maurí­cio wrote: Hi, Why isn't the last line of this code allowed? f :: (TestClass a) => a -> Integer f = const 1 a = (f,f) g = fst a Just to make explicit what other folks have brought up in passing. The real type of @f@ (that is without syntactic sugar) is: > f :: forall a. TestClass

[Haskell-cafe] The Applicative Functor Monad

2008-12-23 Thread Jeremy Shaw
Hello, I want to make a Monad which is almost exactly like the Writer monad, except instead of using mappend to glue Monoids together, it uses <*> to glue applicative functors together. Here is the code: import Control.Applicative import Data.Monoid -- * Sample Implementation of the Writer Mona

Re: [Haskell-cafe] Type classes vr.s functions

2008-12-23 Thread wren ng thornton
Brian Hurt wrote: So, style question for people, if I can. I have a certain problem- basically, I have a bunch of functions which need a special function, of type a -> Foo say. And a bunch of other functions which can define that function on some type of interest, and then what to call the fir

Re: [Haskell-cafe] Re: Detecting system endianness

2008-12-23 Thread John Meacham
On Tue, Dec 23, 2008 at 07:44:14PM -0500, wren ng thornton wrote: > AFAIK, Data.Word.Word is defined to be "the same size as Prelude.Int" > (which it isn't on GHC 6.8.2 on Intel OS X: 32bits vs 31bits) and Int is > defined to be at least 31bits but can be more. My interpretation of this > is

Re: [Haskell-cafe] intercalate and (byte)strings

2008-12-23 Thread John Meacham
On Tue, Dec 23, 2008 at 04:06:38PM +0100, wman wrote: > Thank you, guys, i somehow got the impression that there has to be some > meaning to this. It seemed unprobable, but why would anybody write it like > that if there weren't some reason to it ? ;-))) My guess is that it was probably to gain co

Re: [Haskell-cafe] understanding enumerator/iteratee

2008-12-23 Thread Henning Thielemann
Jason Dusek schrieb: > Henning Thielemann wrote: >> Jason Dusek schrieb: >>> I'm taking a stab at composable streams, starting with >>> cursors. I managed to make a derived cursor today -- as I >>> work through this stuff, I hope to understand >>> Iteratee/Enumerator better. >> How about a wiki pa

Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-23 Thread Henning Thielemann
David Menendez schrieb: > On Sun, Dec 21, 2008 at 11:20 AM, Jan-Willem Maessen > wrote: >> On Dec 21, 2008, at 8:52 AM, Martijn van Steenbergen wrote: >> >>> Hello all, >>> >>> Data.Ord has a handy function called comparing, and its documentation >>> shows an example of its use. >>> >>> But what i

Re: [Haskell-cafe] Defining a containing function on polymorphic list

2008-12-23 Thread Henning Thielemann
Andrew Wagner schrieb: > The problem here is even slightly deeper than you might realize. For > example, what if you have a list of functions. How do you compare two > functions to each other to see if they're equal? There is no good way > really to do it! So, not only is == not completely polymorp

Re: [Haskell-cafe] monad constraint + record update

2008-12-23 Thread Henning Thielemann
Brent Yorgey schrieb: > On Mon, Dec 22, 2008 at 06:19:07PM +0100, Peter Padawitz wrote: >> I'd like to define a monad Set for types in the class Eq. But how can the >> arguments of Set be constrained when Set is defined as an instance of >> Monad? instance Eq a => Monad Set where ... obviously ca

Re: [Haskell-cafe] Defining a containing function on polymorphic list

2008-12-23 Thread Gwern Branwen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Tue, Dec 23, 2008 at 10:48 PM, Henning Thielemann wrote: > Andrew Wagner schrieb: >> The problem here is even slightly deeper than you might realize. For >> example, what if you have a list of functions. How do you compare two >> functions to eac

[Haskell-cafe] Re: Time for a new logo?

2008-12-23 Thread Benjamin L . Russell
My design, entitled "Origami-lambda-supernova-warp," consists of an H composed of two identical vertically tiled lambdas warping from a supernova. It symbolizes the warp of the Haskell-lambda away from the O of object-orientation (symbolized by the supernova). Created in Inkscape, then adjusted in

RE: [Haskell-cafe] Can I build and install GHC 6.10.1withoutprevious installed ghc

2008-12-23 Thread Wang, Chunye (NSN - CN/Beijing)
Hi Duncan, Thanks. IT WORKS ! I install 6.6.1, then compile the 6.10.1. There are some warning message. It seems that it doesn't matter. Best Regards Chunye Wang > Ahh, x86-64. Those have always been built on Fedora Core 5. > My only suggestion is to try older ones, eg 6.6.1. That version

Re: [Haskell-cafe] Re: Time for a new logo?

2008-12-23 Thread Colin Paul Adams
There are a lot of nice designs on the new_logo_ideas page. My favourite by far is Conal's. One thing I noticed - everyone seems to include lower-case lambda in the design, but no-one seems to have replaced the terminal double ell in Haskell with a double lambda. -- Colin Adams Preston Lancashir