Re: [Haskell-cafe] coding a queue with reactive

2011-02-14 Thread Ryan Ingram
One way to think about Reactive's notion of Future is as a single element of an event stream--something that might happen (yielding a value) some time in the future. 'mempty' on futures is a future that never happens, and 'mappend' says to pick the first of two futures to happen. m = k waits for

[Haskell-cafe] Vector library

2011-02-14 Thread Pierre-Etienne Meunier
Hi, This is mostly a question for Roman : how do you use your vector library with multi-dimensional arrays ? I mean, the array library from the standard libraries does something more intelligent than the C-like solution with indirections. For instance, it allows you to program a single

Re: [Haskell-cafe] Vector library

2011-02-14 Thread Max Bolingbroke
On 14 February 2011 10:19, Pierre-Etienne Meunier pierreetienne.meun...@gmail.com wrote: For instance, it allows you to program a single function that works for any dimensionality of the array. I don't know how vector handles it, but you may be interested to look at the repa library

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Pedro Vasconcelos
On Sat, 12 Feb 2011 19:38:31 +0530 C K Kashyap ckkash...@gmail.com wrote: Anyway, how can one go about explaining to an imperative programmer with no FP exposure - what aspect of Haskell makes it easy to refactor? Like other people have said, the static type system is a major factor. It's

Re: [Haskell-cafe] lhs2tex and line numbers

2011-02-14 Thread Andres Loeh
Hi. How could I convince lhs2tex to add in poly mode line numbers before each code line in code block? A long time ago, I've written some experimental code that achieves line numbering in lhs2tex. I've committed the files to the github repository, so you can have a look at the .fmt file and

Re: [Haskell-cafe] Vector library

2011-02-14 Thread Roman Leshchinskiy
Pierre-Etienne Meunier wrote: This is mostly a question for Roman : how do you use your vector library with multi-dimensional arrays ? I mean, the array library from the standard libraries does something more intelligent than the C-like solution with indirections. Vector doesn't include any

Re: [Haskell-cafe] Why is there no splitSeperator function in Data.List

2011-02-14 Thread Peter Simons
Hi Evan, The reason it's not in Data.List is because there are a bazillion different splits one might want (when I was pondering the issue before Brent released it, I had collected something like 8 different proposed splits), so no agreement could ever be reached. It is curious though

Re: [Haskell-cafe] Why is there no splitSeperator function inData.List

2011-02-14 Thread Iustin Pop
On Sun, Feb 13, 2011 at 11:33:16PM -0800, Donn Cave wrote: It is curious though that the Python community managed to agree on a single implementation and include that in the standard library To me, it's more like 2 implementations, overloaded on the same function name. Python 2.6.2

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Tillmann Rendel
Pedro Vasconcelos wrote: This is because all input and output data flow is type checked in a function application, whereas imperative side effects might escape checking. For example, the type signature for a variable swapping procedure in C: void swap(int *a, int *b) This will still

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Pedro Vasconcelos
On Mon, 14 Feb 2011 12:54:55 +0100 Tillmann Rendel ren...@informatik.uni-marburg.de wrote: This benefit of explicit input and output values can interact nicely with parametric polymorphism: swap :: (a, b) - (b, a) This more general type signature makes sure we are not just returning

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Gábor Lehel
On Mon, Feb 14, 2011 at 12:06 PM, Pedro Vasconcelos p...@dcc.fc.up.pt wrote: On Sat, 12 Feb 2011 19:38:31 +0530 C K Kashyap ckkash...@gmail.com wrote: Anyway, how can one go about explaining to an imperative programmer with no FP exposure - what aspect of Haskell makes it easy to refactor?

Re: [Haskell-cafe] ANN: FunGEn-0.3 simple 2D game engine released

2011-02-14 Thread Simon Michael
Hi Andre, good to hear from you. On Feb 13, 2011, at 5:27 PM, Andre Wilson Brotto Furtado wrote: This is great, thanks Simon. I'm currently not involved in any haskell projects anymore, but please do keep the ball rolling for FunGEn. I'm currenty exploring how domain-specific development

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Pedro Vasconcelos
On Mon, 14 Feb 2011 15:07:01 +0100 Gábor Lehel illiss...@gmail.com wrote: I'm not completely sure, but I suspect another part of it (or maybe I'm just rephrasing what you said?) has to do with the fact that in Haskell, basically everything is an expression. Yes, the fact that control

[Haskell-cafe] Unit propagation

2011-02-14 Thread PatrickM
This is my last part from a project and I need some help with the following function: If a clause in a propositional formula contains only one literal, then that literal must be true (so that the particular clause can be satisfied). When this happens, we remove the unit clauses (the ones that

Re: [Haskell-cafe] Why is there no splitSeperator function inData.List

2011-02-14 Thread Donn Cave
Quoth Peter Simons sim...@cryp.to, ... having a dictator is not a necessary prerequisite for the ability to make decisions. It's quite possible to decide controversial matters without a dictator -- say, by letting people vote. The problem might be slightly miscast here, as an inability to

Re: [Haskell-cafe] ghci command line execution

2011-02-14 Thread Henning Thielemann
Thomas Davie schrieb: A while ago I remember someone showing me some tool, I *think* ghci that allowed you to pass it a function of type String - String as an input, and have it simply run that function on stdin (presumably using interact) to achieve useful things like this... $ cat

Re: [Haskell-cafe] Cmdargs and common flags

2011-02-14 Thread Neil Mitchell
Hi Magnus, Finally, you can switch to the pure annotations. I will document them shortly and give an example in System.Console.CmdArgs.Implicit, but for now the details can be found at http://hackage.haskell.org/packages/archive/cmdargs/0.6.7/doc/html/System-Console-CmdArgs-Annotate.html

Re: [Haskell-cafe] [Haskell] Problems with (projects|community).haskell.org

2011-02-14 Thread Alistair Bayley
On 10 February 2011 22:03, Dominique Devriese dominique.devri...@cs.kuleuven.be wrote: Also, is there any news yet on a procedure for community members with accounts on projects.haskell.org to get access to them again? My ssh publickey login is no longer being accepted. I had an account mainly

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Albert Y. C. Lai
On 11-02-12 09:40 PM, Brandon S Allbery KF8NH wrote: Only up to a point. While most of the responses so far focus on the question from one direction, the other is epitomized by a Knuth quote: Beware of bugs in the above code; I have only proved it correct, not tried it. Knuth's definition of

Re: [Haskell-cafe] Unit propagation

2011-02-14 Thread Alexander Solla
On Mon, Feb 14, 2011 at 7:43 AM, PatrickM patrickm7...@yahoo.co.uk wrote: This is my last part from a project and I need some help with the following function: If a clause in a propositional formula contains only one literal, then that literal must be true (so that the particular clause

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Pavel Perikov
Sorely, Haskell can't prove logic with it. No predicates on values, guarantee that proof is not _|_. Haskell makes bug free software affordable, that's true. But it's not a proof assistant. pavel On 14.02.2011, at 22:57, Albert Y. C. Lai wrote: On 11-02-12 09:40 PM, Brandon S Allbery KF8NH

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Albert Y. C. Lai
On 11-02-14 03:03 PM, Pavel Perikov wrote: Sorely, Haskell can't prove logic with it. No predicates on values, guarantee that proof is not _|_. Haskell makes bug free software affordable, that's true. But it's not a proof assistant. Who claimed that Haskell is a proof assistant?

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Pavel Perikov
Who claimed that Haskell is a proof assistant? no one sanely will :) Haskell is a beautiful and practical (!) programming language with great infrastructure and community. Sadly, proving inside haskell is hard :) And it doesn't bring me coffee in the morning too (well, it mostly does)

Re: [Haskell-cafe] Sub-optimal

2011-02-14 Thread Andrew Coppin
Is this a known bug? (GHC 6.10.x) It's known to happen when optimising shares what shouldn't be shared. Try compiling with -O2 -fno-cse (if that doesn't help, it doesn't necessarily mean it's not unwanted sharing, though). And, please, let us see some code to identify the problem. I tried -O2

[Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-14 Thread Patrick Bahr
Hi all, I am trying to get a GHC rewrite rule that specialises a function according to the type of the argument of the function. Does anybody know whether it is possible to do that not with a concrete type but rather a type class? Consider the following example: class A a where toInt

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread kevin
On 14.02.2011, at 03:03 PM, Pavel Perikov [peri...@gmail.com] wrote: Sorely, Haskell can't prove logic with it. No predicates on values, guarantee that proof is not _|_. Haskell makes bug free software affordable, that's true. But it's not a proof assistant. Being equivalent to a class of

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-14 Thread Max Bolingbroke
On 14 February 2011 21:43, Patrick Bahr pa...@arcor.de wrote: Am I doing something wrong or is it not possible for GHC to dispatch a rule according to type class constraints? As you have discovered this is not possible. You can write the rule for as many *particular* types as you like, but you

Re: [Haskell-cafe] Sub-optimal

2011-02-14 Thread Max Bolingbroke
On 14 February 2011 21:00, Andrew Coppin andrewcop...@btinternet.com wrote: Is this a known bug? (GHC 6.10.x) It's known to happen when optimising shares what shouldn't be shared. Try compiling with -O2 -fno-cse (if that doesn't help, it doesn't necessarily mean it's not unwanted sharing,

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-14 Thread Gábor Lehel
On Tue, Feb 15, 2011 at 12:48 AM, Max Bolingbroke batterseapo...@hotmail.com wrote: On 14 February 2011 21:43, Patrick Bahr pa...@arcor.de wrote: Am I doing something wrong or is it not possible for GHC to dispatch a rule according to type class constraints? As you have discovered this is not

Re: [Haskell-cafe] lhs2tex and line numbers

2011-02-14 Thread Mitar
Hi! On Mon, Feb 14, 2011 at 12:23 PM, Andres Loeh andres.l...@googlemail.com wrote: A long time ago, I've written some experimental code that achieves line numbering in lhs2tex. I've committed the files to the github repository, so you can have a look at the .fmt file and the demo document in

[Haskell-cafe] ANN: vector-buffer package 0.1

2011-02-14 Thread Alexander McPhail
Hi, I have uploaded a small package, vector-buffer, to hackage. It provides a buffer that can be turned into a Data.Vector.Storable. The mapM* functions map from the oldest element, not the first. Similarly for the derived Vector. Feature requests etc. welcome. Vivian

Re: [Haskell-cafe] Proving correctness

2011-02-14 Thread Gregory Crosswhite
On 2/11/11 1:25 PM, Luke Palmer wrote: I would like to see a language that allowed optional verification, but that is a hard balance to make because of the interaction of non-termination and the evaluation that needs to happen when verifying a proof. I believe that ATS (short for Advanced Type

Re: [Haskell-cafe] ANN: vector-buffer package 0.1

2011-02-14 Thread Luke Palmer
This interface is an outlaw. main = do buf - newBuffer 10 :: IO (Buffer Int) pushNextElement buf 1 let v1 = V.toList (toVector buf) v2 = V.toList (toVector buf) print v1 pushNextElement buf 2 print v2 Despite v1 and v2 being defined to equal the exact same thing,

Re: [Haskell-cafe] ANN: vector-buffer package 0.1

2011-02-14 Thread Alexander McPhail
Hi Luke, Apologies, I think I got bitten by unsafePerformIO. The reason it wasn't in the IO monad is that the Vector created from the Buffer is supposed to be immutable. I've changed the API so that: main = do buf - newBuffer 10 :: IO (Buffer Int) pushNextElement buf 1 v1 - toVector

[Haskell-cafe] Fwd: ANN: vector-buffer package 0.1

2011-02-14 Thread Alexander McPhail
Hi list, Could someone explain why the error pointed out by Luke occurred? From: Luke Palmer lrpal...@gmail.com I think this would be a very good question for the list. Don't worry, they're nice helpful folks. On Mon, Feb 14, 2011 at 10:10 PM, Alexander McPhail