Re: [Haskell-cafe] haskell in online contests

2009-11-29 Thread Daniel Fischer
Am Samstag 28 November 2009 21:21:20 schrieb vishnu: this is where I've gotten to. http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=5120#a5120 strangely enough Ive gotten no speedup at all from the substitution cost UArray (though I had to make it Int, Int to deal with digits.). Converting

Re: [Haskell-cafe] namespaces for values, types, and classes

2009-11-29 Thread Stuart Cook
On Sun, Nov 29, 2009 at 8:42 AM, pbrowne patrick.bro...@comp.dit.ie wrote: Question 3) Instances are not named so can they be imported? Whenever you import a module, you automatically import all of its instances as well. In fact, there is no way to *not* include instances when importing a

Re: [Haskell-cafe] instance Binary UTCTime (Was: Oprhan instances)

2009-11-29 Thread Duncan Coutts
On Thu, 2009-11-26 at 16:40 -0500, David Menendez wrote: The problem with this solution is that it doesn't scale. If we have M packages providing types and N packages providing classes, then we need M*N additional packages for orphans. The best long-term solution is probably extending Cabal

[Haskell-cafe] Help mixing pure and IO code

2009-11-29 Thread papa . eric
Hi haskell helpers, Learning haskell, I wanted to explore how to write pure code and then add some IO on top of it, keeping the main code pure. The idea was to write a very simple two-player game, then define some strategies to play it that do not involve IO, and finally use strategies involving

Re: [Haskell-cafe] some help debugging ghci build on powerpc

2009-11-29 Thread Duncan Coutts
On Sun, 2009-11-22 at 16:22 -0800, Brian Denheyer wrote: I'm trying to build ghc so that ghci will be included under linux power-pc. The build dies here: /tmp/ghc21791_0/ghc21791_0.s: Assembler messages: /tmp/ghc21791_0/ghc21791_0.s:15:0: Error: junk at end of line, first

Re: [Haskell-cafe] Help mixing pure and IO code

2009-11-29 Thread Bulat Ziganshin
Hello papa, Sunday, November 29, 2009, 5:11:23 PM, you wrote: add some IO on top of it, keeping the main code pure. The idea was to write a very simple two-player game, then define some strategies to play it that do not involve IO ho i could do it: class Strategy state where initState ::

Re: [Haskell-cafe] Help mixing pure and IO code

2009-11-29 Thread klondike
papa.e...@free.fr escribió: Hi haskell helpers, Learning haskell, I wanted to explore how to write pure code and then add some IO on top of it, keeping the main code pure. The idea was to write a very simple two-player game, then define some strategies to play it that do not involve IO, and

Re: [Haskell-cafe] control-monad-failure and mtl

2009-11-29 Thread Jose Iborra
On 28/11/2009, at 22:08, Edward Z. Yang wrote: Hello folks, I took advantage of Thanksgiving weekend to port my application to use Control.Monad.Failure, and learned (slightly painfully) that I still needed to pick some mechanism to instantiate my failure monads as. After the experience,

Re: [Haskell-cafe] ghci breakpoints

2009-11-29 Thread Jose Iborra
Hi Sean, it looks like your Focus module is not interpreted and thus has no breakpoints. (that error message could be easily improved to let you know this) The ghci debugger only works with interpreted code, you can either delete all the *.hi and *.o temporary files or simply use the flag

Re: [Haskell-cafe] Re: ANNOUNCE: Clutterhs 0.1

2009-11-29 Thread Matt Arsenault
On Sun, 2009-11-29 at 08:09 +0100, Gour wrote: What do you think about binding Moblin's nbtk (now it's called mx) ? Right now I'm working on finishing Clutter, Clutter-gtk, and COGL. Otoh, are you aware of: http://github.com/elliottt/clutter http://github.com/yav/clutter I

[Haskell-cafe] Hoogle Down

2009-11-29 Thread Elliot Wolk
hello! im not sure that this is the correct mailing list for saying so, and also whether or not today's down-ness is just scheduled maintenance, but hoogle appears to be down again. sorry if this is known/redundant/not the right place! thanks, elliot

Re: [Haskell-cafe] Help mixing pure and IO code

2009-11-29 Thread Felipe Lessa
On Sun, Nov 29, 2009 at 03:11:23PM +0100, papa.e...@free.fr wrote: However, I wonder how to do it reusing the pure versions, runGame and Strategy? There's a nice approach to this problem which is described and implemented in the MonadPrompt package[1]. Basically you have prompt ::

[Haskell-cafe] peekCString free memory

2009-11-29 Thread El Barto
Hello, I get a segfault when I do str - peekCString ptr free ptr return (Just str) But not when I don't free the C pointer. I also get the same behaviour with ByteString.packCString... Could you please tell me if the memory is correctly freed by GHC when I don't do it myself? And how can I

Re: [Haskell-cafe] peekCString free memory

2009-11-29 Thread Thomas DuBuisson
Could you expand on this fragment of code? Perhaps a fullying compilable example? It depends how you are getting the pointer, not how you are reading data out of the pointer. For example, if you use withCString to get ptr then the memory will be freed automatically. Thomas On Sun, Nov 29,

Re: [Haskell-cafe] instance Binary UTCTime (Was: Oprhan instances)

2009-11-29 Thread Alexander Dunlap
On Sun, Nov 29, 2009 at 5:37 AM, Duncan Coutts duncan.cou...@googlemail.com wrote: On Thu, 2009-11-26 at 16:40 -0500, David Menendez wrote: The problem with this solution is that it doesn't scale. If we have M packages providing types and N packages providing classes, then we need M*N

Re: [Haskell-cafe] peekCString free memory

2009-11-29 Thread Bulat Ziganshin
Hello El, Sunday, November 29, 2009, 8:00:02 PM, you wrote: segfault is due to free, you may omit peekCString call. you should free only memory that was malloced and not freed other way Hello, I get a segfault when I do str - peekCString ptr free ptr return (Just str) But not when I

Re: [Haskell-cafe] peekCString free memory

2009-11-29 Thread Duncan Coutts
On Sun, 2009-11-29 at 18:00 +0100, El Barto wrote: Hello, I get a segfault when I do str - peekCString ptr free ptr return (Just str) As Thomas says, you've not really given us enough info here. I'll make some guesses and observations anyway :-) But not when I don't free the C pointer.

Re: [Haskell-cafe] peekCString free memory

2009-11-29 Thread El Barto
Thanks for your help time, I checked the C API documentation: http://xmlsoft.org/html/libxml-xmlreader.html#xmlTextReaderValue The result must be deallocated with xmlFree() I pushed the sources here: http://github.com/gwenn/libxml-reader My problem is with the function at line 249 in

[Haskell-cafe] Partially applied functions

2009-11-29 Thread Casey Hawthorne
You can pattern match on the right hand side of '|' in a list comprehension, since a list comprehension is just the list monad. Just changed a few things. Hopefully this answers the OP's question and any interested others. add :: Int - Int - Int add x y = x + y -- a list of partially applied

Re: [Haskell-cafe] instance Binary UTCTime (Was: Oprhan instances)

2009-11-29 Thread David Menendez
On Sun, Nov 29, 2009 at 8:37 AM, Duncan Coutts duncan.cou...@googlemail.com wrote: On Thu, 2009-11-26 at 16:40 -0500, David Menendez wrote: The problem with this solution is that it doesn't scale. If we have M packages providing types and N packages providing classes, then we need M*N

[Haskell-cafe] FAD

2009-11-29 Thread Ozgur Akgun
While searching for a design tool for Haskell, I've come across the PhD thesis of Dan Russell http://www.cs.kent.ac.uk/pubs/2001/1152/ He also mentioned the tool in cafe some time ago: http://www.haskell.org/pipermail/haskell-cafe/2003-June/004606.html Does anyone in the cafe, or himself, direct

Re: [Haskell-cafe] Data.Binary and error handling

2009-11-29 Thread Khudyakov Alexey
В сообщении от 27 ноября 2009 23:55:47 Don Stewart написал: alexey.skladnoy: It does but it was already noted that cereal uses strict bytestrings which are not really convenient when dealing with huge inputs. One may end up using both binary and cereal which is not really satisfactory.

Re: [Haskell-cafe] instance Binary UTCTime (Was: Oprhan instances)

2009-11-29 Thread Duncan Coutts
On Sun, 2009-11-29 at 16:42 -0500, David Menendez wrote: On Sun, Nov 29, 2009 at 8:37 AM, Duncan Coutts duncan.cou...@googlemail.com wrote: On Thu, 2009-11-26 at 16:40 -0500, David Menendez wrote: The problem with this solution is that it doesn't scale. If we have M packages providing

Re: [Haskell-cafe] instance Binary UTCTime (Was: Oprhan instances)

2009-11-29 Thread Duncan Coutts
On Sun, 2009-11-29 at 09:55 -0800, Alexander Dunlap wrote: On Sun, Nov 29, 2009 at 5:37 AM, Duncan Coutts duncan.cou...@googlemail.com wrote: On Thu, 2009-11-26 at 16:40 -0500, David Menendez wrote: The problem with this solution is that it doesn't scale. If we have M packages providing

[Haskell-cafe] Haskell Weekly News: Issue 141 - November 29, 2009

2009-11-29 Thread jfredett
--- Haskell Weekly News http://sequence.complete.org/hwn/20091129 Issue 141 - November 29, 2009 --- Welcome to issue 141 of HWN, a newsletter covering

Re: [Haskell-cafe] instance Binary UTCTime (Was: Oprhan instances)

2009-11-29 Thread Alexander Dunlap
On Sun, Nov 29, 2009 at 4:41 PM, Duncan Coutts duncan.cou...@googlemail.com wrote: On Sun, 2009-11-29 at 09:55 -0800, Alexander Dunlap wrote: On Sun, Nov 29, 2009 at 5:37 AM, Duncan Coutts duncan.cou...@googlemail.com wrote: On Thu, 2009-11-26 at 16:40 -0500, David Menendez wrote: The

Re: [Haskell-cafe] instance Binary UTCTime

2009-11-29 Thread Ivan Lazar Miljenovic
Alexander Dunlap alexander.dun...@gmail.com writes: Well, that happens anyway with most packages since distros have to choose one set of flags that works. The proposal I was commenting on would just allow packages to depend on flags of other packages and so be explicit about this. Consider

[Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-11-29 Thread John Millikin
I'm working on a library which needs to operate on large data sets, so I'd like to use lazy values. The library consists of pure functions from Text to [Event] and back. Normally, I use Maybe or Either for error handling in pure code, but using these precludes lazy evaluation. Using exceptions

[Haskell-cafe] Haskell Job Openings (Pune, IN)

2009-11-29 Thread Tom Hawkins
We finally got some open reqs in Eaton's engineering center in Pune, India. Could involve a little Haskell programming, or a lot, depending on what you want to do.

[Haskell-cafe] hscolour + unicode

2009-11-29 Thread Sean McLaughlin
Hello, Is there a way to get the source documentation from cabal haddock --hyperlink-source to show up with unicode characters preserved? Right now the unicode from my comments and source programs are being mangled. I tried the --haddock-option=--use-unicode option, but it seems to only work

Re: [Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-11-29 Thread Malcolm Wallace
I'm working on a library which needs to operate on large data sets, so I'd like to use lazy values. ... import qualified Data.Text as T parse :: TL.Text - [Either ParseError Event] I would say that this is the

Re: [Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-11-29 Thread Luke Palmer
On Sun, Nov 29, 2009 at 11:08 PM, Malcolm Wallace malcolm.wall...@cs.york.ac.uk wrote: Are you sure that there can be no error recovery, to continue with events after a mal-formed event has been discarded?  In many cases, it is possible.  However, if you really want to terminate the stream at