[Haskell-cafe] Re: Timing and Atom

2009-11-30 Thread Tom Hawkins
On Tue, Dec 1, 2009 at 2:24 AM, Lee Pike wrote: > Tom, > > I have a (hopefully) easy question about timing and Atom in the use-case > where you're handling all your own scheduling without relying on a RTOS > (where you get preemption).  Suppose I want a rule to fire every 2ms. >  Naturally, I'd wa

[Haskell-cafe] Optimizing Parsec 3 -- was: Wiki software?

2009-11-30 Thread Paulo Tanimoto
Hello! On Mon, Nov 23, 2009 at 12:29 PM, Antoine Latter wrote: > On Sun, Nov 22, 2009 at 11:56 AM, Antoine Latter wrote: >> >> Running 'pandoc --strict' over the Markdown readme.text takes: >> >> ~0.09s with pandoc built against parsec-2 >> ~0.19s with pandoc built against parsec-3 >> >> on my m

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

2009-11-30 Thread John Millikin
On Mon, Nov 30, 2009 at 03:02, Duncan Coutts wrote: > On Mon, 2009-11-30 at 06:08 +, Malcolm Wallace wrote: >> However, if you really want to terminate the stream at >> the first error, and to reflect this in the type, then I guess you can >> define your own list type: >> >> data ListThenError

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

2009-11-30 Thread Luke Palmer
On Mon, Nov 30, 2009 at 8:36 PM, Hector Guilarte wrote: > One time I needed to do use a random number in some places of a completly > pure program so I made a infinite list of random numbers and passed it > around all the time in the functions as they where called, using the head of > the list I p

Re: [Haskell-cafe] Great Programs to Read?

2009-11-30 Thread Derek Elkins
On Mon, Nov 30, 2009 at 6:22 AM, Michael Lesniak wrote: > Hello, > > In terms of > >  "to become a great programmer, you need to read great programs"[1] > > what are "great" programs written in Haskell (for your personal > definition of great), which source code is freely available on hackage > or

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

2009-11-30 Thread Hector Guilarte
One time I needed to do use a random number in some places of a completly pure program so I made a infinite list of random numbers and passed it around all the time in the functions as they where called, using the head of the list I passed to the function whenever I needed a random number and retur

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

2009-11-30 Thread Matt Arsenault
On Mon, 2009-11-30 at 09:22 +0100, Gour wrote: > Do you have some public repo for the project's code? I thought I mentioned this somewhere, but I've been using this git repo: http://jayne.hortont.com/git/cgit.cgi/clutterhs.git/ ___ Haskell-Cafe maili

Re: [Haskell-cafe] Re: ANNOUNCE: haskell-mode 2.7.0

2009-11-30 Thread Ivan Lazar Miljenovic
Tom Tobin writes: > On Nov 30, 2009, at 5:06 PM, Ivan Lazar Miljenovic wrote: >> The "default" Hlint keybinding is C-c l: > > Doesn't that violate the emacs proscription against taking "C-c > (letter)" bindings, as they are intended to be reserved for the user? Well, the Emacs integration that c

Re: [Haskell-cafe] Function composition questions from a newbie

2009-11-30 Thread leledumbo
> This doesnt. But why? Back to the definition of function composition: f . g is possible if g returns a value that's compatible with f's argument. Now, let's check the type of square and add3: square :: Num a => a -> a add3 :: Num a => a -> a -> a -> a (square . add3 1 2) is actually seen by t

Re: [Haskell-cafe] Re: ANNOUNCE: haskell-mode 2.7.0

2009-11-30 Thread Tom Tobin
On Nov 30, 2009, at 5:06 PM, Ivan Lazar Miljenovic wrote: > The "default" Hlint keybinding is C-c l: Doesn't that violate the emacs proscription against taking "C-c (letter)" bindings, as they are intended to be reserved for the user? From the GNU Emacs manual: "Don't define C-c letter as a key

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

2009-11-30 Thread Eric Dedieu
> > Still more importantly to me, I understand that anyhow if I intend > > to use IO or random numbers, I must design my strategy from the > > beginning as "encapsulated in a monad". Something like: > > > > class (Monad m) => Strategy m a where ... > > > That's not true at all, you can always p

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

2009-11-30 Thread klondike
Eric Dedieu escribió: > Still more importantly to me, I understand that anyhow if I intend to > use IO or random numbers, I must design my strategy from the beginning > as "encapsulated in a monad". Something like: > > class (Monad m) => Strategy m a where ... > That's not true at all, you can

[Haskell-cafe] Re: ANNOUNCE: haskell-mode 2.7.0

2009-11-30 Thread Ivan Lazar Miljenovic
Svein Ove Aas writes: > * New command: M-x haskell-check, calls (by default) hlint on the > current file. Also bound to C-c C-v. I've got two potential problems with this: * For package maintenance purposes, the default inclusion of hlint could cause some problems (for starters, in Gentoo ha

[Haskell-cafe] Re: ANNOUNCE: haskell-mode 2.7.0

2009-11-30 Thread Roel van Dijk
> * fill-paragraph (M-q) now only affects comments, and correctly >  handles Haddock commentary. adaptive-fill-mode is turned off, as it >  was interfering. This is awesome. I have to retrain my fingers not to fear M-q anymore. ___ Haskell-Cafe mailing li

[Haskell-cafe] Tips for a FFI-wrapped C library?

2009-11-30 Thread Casey Hawthorne
I would suspect that the IO Monad is to unsafe, maybe a more stringent monad would be more appropriate. -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Function composition questions from a newbie

2009-11-30 Thread muad
newbie2009 wrote: > > I am a newbie. Consider this code: > > square x = x * x > add3 x y z = x + y + z > add x y = x + y > composition5 x = (square . add3) x > composition6 x y = (square . add3) x y > > 1) What arguments can i pass to composition5? Please give an example of > calling it. > 2

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

2009-11-30 Thread Eric Dedieu
> There's a nice approach to this problem which is described > and implemented in the MonadPrompt package[1]. Thanks a lot for this link. The "guessing game" example linked to from the documentation is still very hard to understand (I'm still struggling with monads), but it seems to fill my needs.

Re: [Haskell-cafe] haddock + class instances + hidden types

2009-11-30 Thread Ross Paterson
On Mon, Nov 30, 2009 at 04:14:03PM -0500, Sean McLaughlin wrote: > Is there a way to make haddock not generate instance documentation > for non-exported types? Right now for instance, if there is a class A > in module A, and I have a hidden type B in module B and I have > instance A.A B in modul

Re: [Haskell-cafe] Parsec - separating Parsing from Lexing

2009-11-30 Thread Fernando Henrique Sanches
Hi. I believe I'm using parsec 3.0.1, although I already fixed the imports (even thou they were working). Thanks for the references, specially the parsec User Guide - it saved my life, in 30 minutes I actually *understood* my mistake and fixed it. Now my code and it compiles and makes sense, even

[Haskell-cafe] haddock + class instances + hidden types

2009-11-30 Thread Sean McLaughlin
Hi, Is there a way to make haddock not generate instance documentation for non-exported types? Right now for instance, if there is a class A in module A, and I have a hidden type B in module B and I have instance A.A B in module B, then in the documentation for module A, the (supposedly hidden)

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

2009-11-30 Thread Edward Z. Yang
Excerpts from Jose Iborra's message of Sun Nov 29 10:41:50 -0500 2009: > There is indeed an Monad instance for Either in mtl, > declared in the module Control.Monad.Error. > I can't explain why your compiler cannot find it. > Can you paste a blurb of code somewhere? {-# LANGUAGE PackageImports

Re: [Haskell-cafe] Great Programs to Read?

2009-11-30 Thread Roman Cheplyaka
* Don Stewart [2009-11-30 13:01:11-0800] > mlesniak: > > Hello, > > > > In terms of > > > > "to become a great programmer, you need to read great programs"[1] > > > > what are "great" programs written in Haskell (for your personal > > definition of great), which source code is freely availabl

Re: [Haskell-cafe] peekCString & free memory

2009-11-30 Thread El Barto
Ok, I used this advice: http://www.haskell.org/haskellwiki/GHC/Using_the_FFI#Importing_C_functions_that_turn_out_to_be_CPP_macros to make 'xmlFree' callable from Haskell. I was completly wrong in my first post... I do apologize. On Sun, Nov 29, 2009 at 8:56 PM, El Barto wrote: > Thanks for your

Re: [Haskell-cafe] Great Programs to Read?

2009-11-30 Thread Don Stewart
mlesniak: > Hello, > > In terms of > > "to become a great programmer, you need to read great programs"[1] > > what are "great" programs written in Haskell (for your personal > definition of great), which source code is freely available on hackage > or somewhere else on the net? > > I'm person

Re: [Haskell-cafe] Great Programs to Read?

2009-11-30 Thread Luke Palmer
On Mon, Nov 30, 2009 at 5:22 AM, Michael Lesniak wrote: > Hello, > > In terms of > >  "to become a great programmer, you need to read great programs"[1] > > what are "great" programs written in Haskell (for your personal > definition of great), which source code is freely available on hackage > or

Re: [Haskell-cafe] Parsec - separating Parsing from Lexing

2009-11-30 Thread Ryan Ingram
Hi Fernando. I tried this approach for a toy language as well, and I was unhappy with it. I have found that, with Parsec, it is best to *not* split your parsing completely into "tokenization" and "parsing" phases, but rather to interleave them. Instead of > tokenize :: Parser [MJVal] make > t

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread Daniel Fischer
Am Montag 30 November 2009 20:01:04 schrieb michael rice: > Hi all, > > A lot of things posted here I wasn't aware of. My original example involved > ~(x,y), so, returning to that context, how would these two simple cases > vary: > > add2 :: (Int,Int) -> Int > add2 (x,y) = x+y > > add2 :: (Int,Int)

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread Ryan Ingram
Consider these two functions: z = ([], []) alt1 = foldr f z where f a (x,y) = (a:y, x) alt2 = foldr g z where g a ~(x,y) = (a:y, x) alt1 (1:2:3:undefined) = foldr f z (1:2:3:undefined) = f 1 (foldr f z (2:3:undefined)) -- Now f 1 needs to evaluate its second argument for the pattern mat

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread David Menendez
On Mon, Nov 30, 2009 at 2:01 PM, michael rice wrote: > > Hi all, > > A lot of things posted here I wasn't aware of. My original example involved > ~(x,y), so, > returning to that context, how would these two simple cases vary: > > add2 :: (Int,Int) -> Int > add2 (x,y) = x+y > > add2 :: (Int,Int)

[Haskell-cafe] Multi-versioning and compatibility classes.

2009-11-30 Thread Jason Dusek
I have been looking at the Cabal roadmap (tickets marked for bottom) and notice that no one has mentioned multi-versioning or compatibility classes. Maybe these are bad ideas? Multi-versioning seems highly desirable. Essentially, it allows us to have the same qualified names be provided

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread michael rice
Hi all, A lot of things posted here I wasn't aware of. My original example involved ~(x,y), so, returning to that context, how would these two simple cases vary: add2 :: (Int,Int) -> Int add2 (x,y) = x+y add2 :: (Int,Int) -> Int add2 ~(x,y) = x+y I guess what I'm looking for is the concept tha

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread Daniel Fischer
Am Montag 30 November 2009 19:32:01 schrieb Brandon S. Allbery KF8NH: > On Nov 30, 2009, at 13:26 , michael rice wrote: > > So, ALL patterns are strict, unless one precedes them with "~"? > > "case" patterns are strict (this includes pattern matching in function > arguments). > "let" patterns are l

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread Daniel Fischer
Am Montag 30 November 2009 19:26:13 schrieb michael rice: > So, ALL patterns are strict, unless one precedes them with "~"? Or they appear in a let-binding: Prelude> let f xs = let (x:y:zs) = xs in True Prelude> f [] True > > Michael ___ Haskell-Cafe

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread Brandon S. Allbery KF8NH
On Nov 30, 2009, at 13:26 , michael rice wrote: So, ALL patterns are strict, unless one precedes them with "~"? "case" patterns are strict (this includes pattern matching in function arguments). "let" patterns are lazy. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread michael rice
So, ALL patterns are strict, unless one precedes them with "~"? Michael --- On Mon, 11/30/09, Brandon S. Allbery KF8NH wrote: From: Brandon S. Allbery KF8NH Subject: Re: [Haskell-cafe] Mystery operator? To: "michael rice" Cc: "Brandon S. Allbery KF8NH" , haskell-cafe@haskell.org Date: Monday,

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread Brandon S. Allbery KF8NH
On Nov 30, 2009, at 12:47 , michael rice wrote: From: http://www.haskell.org/haskellwiki/Blow_your_mind#Polynomials -- splitting in two (alternating) -- "1234567" -> ("1357", "246") -- the lazy match with ~ is necessary for efficiency, especially enabling processing of infinite lists

Re: [Haskell-cafe] Define a module in multiple files

2009-11-30 Thread Roel van Dijk
On Mon, Nov 30, 2009 at 6:27 PM, Ozgur Akgun wrote: > Nice idea, but this way you still need to modify the single module which > glues them alltogether. > I wanted to allow the users of the module add some functionality to the > module itself. I don't think that is possible. But a user could eas

Re: [Haskell-cafe] Mystery operator?

2009-11-30 Thread Jochem Berndsen
michael rice wrote: > From: http://www.haskell.org/haskellwiki/Blow_your_mind#Polynomials > > -- splitting in two (alternating) > -- "1234567" -> ("1357", "246") > -- the lazy match with ~ is necessary for efficiency, especially enabling > processing of infinite lists > foldr (\a ~(x,y) -

[Haskell-cafe] Mystery operator?

2009-11-30 Thread michael rice
From: http://www.haskell.org/haskellwiki/Blow_your_mind#Polynomials   -- splitting in two (alternating)   -- "1234567" -> ("1357", "246")   -- the lazy match with ~ is necessary for efficiency, especially enabling processing of infinite lists   foldr (\a ~(x,y) -> (a:y,x)) ([],[]) This works but

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

2009-11-30 Thread John Lato
> From: Bas van Dijk > > On Mon, Nov 30, 2009 at 6:22 AM, John Millikin wrote: >> ...I've considered two possible error handling modes... > > Regarding parsing, there's a third option: iteratees[1]. See [2] for a > motivation and description of iteratees. > I think it's interesting to note that

Re: [Haskell-cafe] Define a module in multiple files

2009-11-30 Thread Ozgur Akgun
Nice idea, but this way you still need to modify the single module which glues them alltogether. I wanted to allow the users of the module add some functionality to the module itself. Thanks for the perspective though, -- Ozgur 2009/11/30 Roel van Dijk > On Mon, Nov 30, 2009 at 5:15 PM, Ozgur

Re: [Haskell-cafe] Define a module in multiple files

2009-11-30 Thread Roel van Dijk
On Mon, Nov 30, 2009 at 5:15 PM, Ozgur Akgun wrote: > Is there a way of splitting the definition of a module into multiple files? Let's say you have some module A which introduces 3 symbols: module A (a, b, c) where a = 1 b = 2 c = 3 Now we will split it in 3 modules: module B ( b ) where b =

Re: [Haskell-cafe] Parsec - separating Parsing from Lexing

2009-11-30 Thread Stephen Tetley
Hi Fernando Which version of Parsec are you using, the one that ships with GHC or Parsec 3? I would imagine whichever you one you are using you have the imports wrong for these modules: import Text.Parsec.Pos import Text.Parsec.Prim should be ... import Text.ParserCombinators.Parsec.Pos import

[Haskell-cafe] Define a module in multiple files

2009-11-30 Thread Ozgur Akgun
Dear Cafe, Is there a way of splitting the definition of a module into multiple files? Cheers, -- Ozgur Akgun ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] ANNOUNCE: Blueprint 0.1 -- PREVIEW

2009-11-30 Thread Gregory Crosswhite
I earlier posted to this list asking for help in getting Cabal to play with a Fortran compiler. When it turned out that there was no answer to this, I of course did the obvious thing --- I wrote my own build system. :-) It already boasts the following features: * Fully self-hosting --

[Haskell-cafe] ANNOUNCE: haskell-mode 2.7.0

2009-11-30 Thread Svein Ove Aas
Haskell-mode, a major mode for writing Haskell code in Emacs, has been updated to version 2.7.0. This release contains mostly bugfixes, but also adds support for hlint highlighting via flymake. Additionally, haskell-mode now has a bug-tracker and mailing list. Mailing list: http://projects.haske

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

2009-11-30 Thread Duncan Coutts
On Mon, 2009-11-30 at 13:36 +0100, Bas van Dijk wrote: > On Mon, Nov 30, 2009 at 11:35 AM, Duncan Coutts > wrote: > > Ah but flags are not allowed to change the public exported API of a > > library. > > I wasn't aware of this. Where is this documented? Hmm, I'm not sure it is actually. It should

Re: [Haskell-cafe] Parsec - separating Parsing from Lexing

2009-11-30 Thread Fernando Henrique Sanches
Hello again. First, I'd like to thank you both for your help. You gave me nice tips and nice material. However, I think there is something I'm missing here. I've coded most of the parser, and I have a feeling I'm doing some great mistake. Not only my code won't compile, I don't know how to deal w

[Haskell-cafe] ANNOUNCE: graphviz-2999.7.0.0

2009-11-30 Thread Ivan Lazar Miljenovic
I'm pleased to announce the latest version of my Haskell bindings to the Graphviz [1] suite of tools for visualising graphs. As usual, it is available from Hackage [2]. [1] http://graphviz.org/ [2] http://hackage.haskell.org/package/graphviz Changes in this release include: * Updated and extend

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

2009-11-30 Thread Bas van Dijk
On Mon, Nov 30, 2009 at 11:35 AM, Duncan Coutts wrote: > Ah but flags are not allowed to change the public exported API of a > library. I wasn't aware of this. Where is this documented? The reason I ask is because I have a small package on hackage that violates this: http://hackage.haskell.org/

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

2009-11-30 Thread Bas van Dijk
On Mon, Nov 30, 2009 at 6:22 AM, John Millikin wrote: > ...I've considered two possible error handling modes... Regarding parsing, there's a third option: iteratees[1]. See [2] for a motivation and description of iteratees. regards, Bas [1] http://hackage.haskell.org/package/iteratee [2] http:

[Haskell-cafe] Great Programs to Read?

2009-11-30 Thread Michael Lesniak
Hello, In terms of "to become a great programmer, you need to read great programs"[1] what are "great" programs written in Haskell (for your personal definition of great), which source code is freely available on hackage or somewhere else on the net? I'm personally also interested in your def

Re: Re[2]: [Haskell-cafe] License question

2009-11-30 Thread Malcolm Wallace
i don't think that "reproducing in its entirety" is more permissive for his purpose :) I think translating to F# counts as modification, so the other clause of the license applies; namely you can do anything you like with it, provided you do not claim it defines Haskell'98. Regards, Ma

Re[2]: [Haskell-cafe] License question

2009-11-30 Thread Bulat Ziganshin
Hello Malcolm, Monday, November 30, 2009, 1:45:29 PM, you wrote: > And in fact the official Haskell'98 libraries are covered by an even > more permissive license: that of the Language Report. > "The authors intend this Report to belong to the entire Haskell > community, and so we grant permiss

Re: [Haskell-cafe] License question

2009-11-30 Thread Duncan Coutts
On Mon, 2009-11-30 at 09:43 +0100, jean-christophe mincke wrote: > Hello, > > I am writing a port to F# of some haskell standard libraries. > > I would like to publish them under an open source license and mention > the origin of the initial code. > > www.haskell.org is under the simple permiss

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

2009-11-30 Thread Duncan Coutts
On Mon, 2009-11-30 at 06:08 +, Malcolm Wallace wrote: > However, if you really want to terminate the stream at > the first error, and to reflect this in the type, then I guess you can > define your own list type: > > data ListThenError e a = Cons a (ListThenError e a) >

Re: [Haskell-cafe] License question

2009-11-30 Thread Malcolm Wallace
www.haskell.org is under the simple permissive license. Does this license also cover the souce code available from that site? the license cover only Wiki contents. std haskell libraries covered by BSD3 license, for example as a part of bsd3-covered GHC distribution And in fact the official

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

2009-11-30 Thread Duncan Coutts
On Sun, 2009-11-29 at 19:38 -0800, Alexander Dunlap wrote: > > Then the other bit you suggested foomonad >= 4.0 && < 4.1 && HAS_MTL > > would be needed to be able to express that you want a package that has > > been built with a particular optional instance provided. This is the bit > > that canno

Re: [Haskell-cafe] License question

2009-11-30 Thread Bulat Ziganshin
Hello jean-christophe, Monday, November 30, 2009, 11:43:00 AM, you wrote: > I am writing a port to F# of some haskell standard libraries. > www.haskell.org is under the simple permissive license.  Does this > license also cover the souce code available from that site? the license cover only Wik

[Haskell-cafe] License question

2009-11-30 Thread jean-christophe mincke
Hello, I am writing a port to F# of some haskell standard libraries. I would like to publish them under an open source license and mention the origin of the initial code. www.haskell.org is under the simple permissive license. Does this license also cover the souce code available from that site

[Haskell-cafe] Re: ANNOUNCE: Clutterhs 0.1

2009-11-30 Thread Gour
On Sun, 29 Nov 2009 10:54:01 -0500 >> "Matt" == Matt Arsenault wrote: Matt> Right now I'm working on finishing Clutter, Clutter-gtk, and COGL. Great. I believe Clutterhs can make Haskell development for Moblin quite interesting (& possible). :-) Now I need to pull gtk2hs sources 'cause la