[Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread Ketil Malde
I'm following Harper's blog, Existential Type¹, which I find to be an enjoyable and entertainingly written tirade about the advantages of teaching functional programming - specifically ML - to students. Of course, he tends to be critical of Haskell, but it's nice to get some thought provoking

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread MigMit
Yes, I'm following it too, and it seems to me that Harper just allows his dislike for Haskell to take advantage of his judgement. Monads as a way to deal with laziness are a very common misconception. Отправлено с iPhone May 2, 2011, в 11:54, Ketil Malde ke...@malde.org написал(а): I'm

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread Scott Turner
On 2011-05-02 03:54, Ketil Malde wrote: There is a particular reason why monads had to arise in Haskell, though, which is to defeat the scourge of laziness. I wonder if there are any other rationale for a statement like that? He spends one paragraph dismissing the usefulness of

[Haskell-cafe] Links into list

2011-05-02 Thread John Sneer
Hello all, I have rather strange question. I wonder whether there is an obvious solution or not in Haskell. I tried but without defining quite ugly tree-like structures and incorporating IORefs it seems to me like impossible. Note: I use ASCII art to explain. let l be a Haskell list

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Ivan Lazar Miljenovic
On 2 May 2011 11:10, John Sneer johnsn...@operamail.com wrote: Hello all,  I have rather strange question. I wonder whether there is an obvious solution or not in Haskell. I tried but without defining quite ugly tree-like structures and incorporating IORefs it seems to me like impossible.

Re: [Haskell-cafe] How to make ghc 7 with llvm?

2011-05-02 Thread Magicloud Magiclouds
Sorry to reply after so long time. When you say there is no proble, I understand it as: Even if some libraries were compiled with gcc, they are still linkable with object files generated with llvm. So this remembered me a problem I met long ago with no answer. I compiled ghc 7 with ghc 6 and

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Felipe Almeida Lessa
On Mon, May 2, 2011 at 8:16 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 2 May 2011 11:10, John Sneer johnsn...@operamail.com wrote: Hello all,  I have rather strange question. I wonder whether there is an obvious solution or not in Haskell. I tried but without defining quite

Re: [Haskell-cafe] Links into list

2011-05-02 Thread John Sneer
Well, I have more or less similar solution, but its efficiency for map/foldr etc. is quite low :-( Nevertheless, probably no other solution. BR and thanks John -- John Sneer johnsn...@operamail.com On Mon, 02 May 2011 08:32 -0300, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Ivan Lazar Miljenovic
Re-CCing the list. On 2 May 2011 11:33, John Sneer johnsn...@operamail.com wrote: I took a look at http://cvs.haskell.org/Hugs/pages/libraries/base/Data-Sequence.html but it doesn't seem to be helpful - cannot insert sequence into the sequence, just modification of a single element is

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Twan van Laarhoven
On 02/05/11 13:10, John Sneer wrote: Simply: I would like to have direct access into several places in a very long list. Maybe you could use a zipper. Or just maintain the list split into chunks. So l' = [stuffBefore,hi,stuffAfter]. Or if you want to be able to use each element of hi as a

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread Dominique Devriese
2011/5/2 Ketil Malde ke...@malde.org: There is a particular reason why monads had to arise in Haskell, though, which is to defeat the scourge of laziness. My own view is/was that monads were so successful in Haskell since it allowed writing flexible programs with imperative features,

Re: [Haskell-cafe] [web-devel] Odd Ambiguous type variable `a0' in the constraint: error (with Yesod)

2011-05-02 Thread Mathew de Detrich
Ok I have found the source issue, in my case it was an issue that ended up turning into how the modules for my Webserver is organized, and that compiler error (about an ambiguous type) occurred because my main webserver datatype was not instantiated yet in that module (using where aproot). In

Re: [Haskell-cafe] [web-devel] Odd Ambiguous type variable `a0' in the constraint: error (with Yesod)

2011-05-02 Thread Michael Snoyman
Actually, there's a much simpler solution already implemented in the scaffolded site: instead of using mkYesod, use mkYesodData and mkYesodDispatch. mkYesod is really just a combination of the two. The former defines your route datatype, and the latter creates the YesodDispatch instance. This

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread Felipe Almeida Lessa
On Mon, May 2, 2011 at 9:29 AM, Dominique Devriese dominique.devri...@cs.kuleuven.be wrote: I agree with your analysis. Throughout his different articles, I think Harper partly has a point when he says that laziness brings certain disadvantages (like e.g. complex memory and CPU behaviour) to

[Haskell-cafe] GLUT error while using Gloss

2011-05-02 Thread Artyom Kazak
Hi Cafe! When I'm running examles from Gloss graphics library, all examples except gloss-hello are crashing with the following error: GLUT: Warning in gloss-easy: GL error: gloss-easy: stderr: hPutChar: invalid argument (character is not in the code page). A window with produced picture is showed

Re: [Haskell-cafe] [web-devel] Odd Ambiguous type variable `a0' in the constraint: error (with Yesod)

2011-05-02 Thread Mathew de Detrich
.. You tell me this now ;) I was actually wanting to look at scaffolding, but the section for it in the Yesod book is not completed yet (http://www.yesodweb.com/book/scaffold) Well that was like 4 hours wasted Do you have a quick example of how scaffolding is done with mkYesodData and

Re: [Haskell-cafe] [web-devel] Odd Ambiguous type variable `a0' in the constraint: error (with Yesod)

2011-05-02 Thread Michael Snoyman
My best advice is to just run the scaffolder. Any other examples I can point you to (like the Haskellers source code) will contain a lot of extra information that won't necessarily apply to your case. Michael On Mon, May 2, 2011 at 4:28 PM, Mathew de Detrich dete...@gmail.com wrote: .. You

Re: [Haskell-cafe] [web-devel] Odd Ambiguous type variable `a0' in the constraint: error (with Yesod)

2011-05-02 Thread Mathew de Detrich
Im not sure what you mean exactly by run the scaffolder, (just to be clear, I am not exactly sure what technically scaffolding is apart from it being referenced once or twice in your documentation) I assume you are talking about setting up the handlers for a specific route, and then creating that

Re: [Haskell-cafe] [web-devel] Odd Ambiguous type variable `a0' in the constraint: error (with Yesod)

2011-05-02 Thread Michael Snoyman
Type: yesod init It will ask you some questions and then generate a bootstrap site. Michael On Mon, May 2, 2011 at 4:40 PM, Mathew de Detrich dete...@gmail.com wrote: Im not sure what you mean exactly by run the scaffolder, (just to be clear, I am not exactly sure what technically

Re: [Haskell-cafe] [web-devel] Odd Ambiguous type variable `a0' in the constraint: error (with Yesod)

2011-05-02 Thread Mathew de Detrich
Ok thanks, that helped On Mon, May 2, 2011 at 11:53 PM, Michael Snoyman mich...@snoyman.comwrote: Type: yesod init It will ask you some questions and then generate a bootstrap site. Michael On Mon, May 2, 2011 at 4:40 PM, Mathew de Detrich dete...@gmail.com wrote: Im not sure what

Re: [Haskell-cafe] ANN: Leksah 0.10.0

2011-05-02 Thread jutaro
Hi Mathew, I was not the one working on Yi integration so far, but let me tell you what I think of the matter. Yi attempts to be a full blown editor, while Leksah needs Yi as a library for text editing with features typical of a source code editor component. What we have in Leksah is an abstract

Re: [Haskell-cafe] GLUT error while using Gloss

2011-05-02 Thread Jason Dagit
On Mon, May 2, 2011 at 6:29 AM, Artyom Kazak artyom.ka...@gmail.com wrote: Hi Cafe! When I'm running examles from Gloss graphics library, all examples except gloss-hello are crashing with the following error: GLUT: Warning in gloss-easy: GL error: gloss-easy: stderr: hPutChar: invalid

Re: [Haskell-cafe] GLUT error while using Gloss

2011-05-02 Thread Artyom Kazak
It's good to hear. Thanks! 2011/5/2 Jason Dagit dag...@gmail.com:  This is fixed in the git repository for GLUT, but I didn't push the fix to hackage yet: https://github.com/haskell-opengl/GLUT/pull/1 Sorry for the inconvenience! Jason ___

[Haskell-cafe] Interfacing C++ iterators does not work as expected

2011-05-02 Thread Huynh Huu Long
Hi, I tried to access C++ iterators from Haskell via the FFI. There are two example programs attached, in Haskell as well as in C++. Both utilise the same iterator wrapper example.cpp, but when running the Haskell program it prints an empty list, where it should print the contents of some vector.

[Haskell-cafe] Reformatter for Show

2011-05-02 Thread Alexey Khudyakov
Hello everyone! Haskell have nice automatically derivable Show type class. It's quite useful for debugging with one exception. String representation of even moderately large value is completely unreadable (example below). My question is there any tool for reformatting result of show so it

Re: [Haskell-cafe] Reformatter for Show

2011-05-02 Thread Ozgur Akgun
Hi Alexey, On 2 May 2011 21:01, Alexey Khudyakov alexey.sklad...@gmail.com wrote: My question is there any tool for reformatting result of show so it could be read by human beings? http://hackage.haskell.org/package/pretty-show Just use ppShow, instead of show. Hope this helps, Ozgur

Re: [Haskell-cafe] Reformatter for Show

2011-05-02 Thread Christopher Done
On 2 May 2011 22:01, Alexey Khudyakov alexey.sklad...@gmail.com wrote: Hello everyone! Haskell have nice automatically derivable Show type class. It's quite useful for debugging with one exception. String representation of even moderately large value is completely unreadable (example below).

Re: [Haskell-cafe] Interfacing C++ iterators does not work as expected

2011-05-02 Thread Gábor Lehel
It works if I replace the 'bool' return type of 'finished' with int and CInt on the C++ and Haskell side, respectively, and test for (/= 0). On Mon, May 2, 2011 at 9:35 PM, Huynh Huu Long long.upc...@googlemail.com wrote: Hi, I tried to access C++ iterators from Haskell via the FFI. There are

Re: [Haskell-cafe] Reformatter for Show

2011-05-02 Thread Antoine Latter
On Mon, May 2, 2011 at 3:01 PM, Alexey Khudyakov alexey.sklad...@gmail.com wrote: Hello everyone! Haskell have nice automatically derivable Show type class. It's quite useful for debugging with one exception. String representation of even moderately large value is completely unreadable

Re: [Haskell-cafe] versioning of Haskell packages

2011-05-02 Thread Henning Thielemann
Rogan Creswick schrieb: We *do* still have some trouble maintaining / enforcing the PVP in general, and there are a few things that it doesn't cover (I don't believe exception behavior is covered, for example, although I'd argue that throwing more exceptions than a previous version introduces

Re: [Haskell-cafe] Interfacing C++ iterators does not work as expected

2011-05-02 Thread Huynh Huu Long
Big thanks, that works for me as well. Doesn't GHC check whether a type is allowed (like CInt,...) or not (like Bool,...)? 2011/5/2 Gábor Lehel illiss...@gmail.com: It works if I replace the 'bool' return type of 'finished' with int and CInt on the C++ and Haskell side, respectively, and test

Re: [Haskell-cafe] Reformatter for Show

2011-05-02 Thread Erik de Castro Lopo
Ozgur Akgun wrote: Hi Alexey, On 2 May 2011 21:01, Alexey Khudyakov alexey.sklad...@gmail.com wrote: My question is there any tool for reformatting result of show so it could be read by human beings? http://hackage.haskell.org/package/pretty-show Just use ppShow, instead of

Re: [Haskell-cafe] Reformatter for Show

2011-05-02 Thread Alexey Khudyakov
On 03.05.2011 00:43, Antoine Latter wrote: On Mon, May 2, 2011 at 3:01 PM, Alexey Khudyakov alexey.sklad...@gmail.com wrote: Hello everyone! Haskell have nice automatically derivable Show type class. It's quite useful for debugging with one exception. String representation of even moderately

Re: [Haskell-cafe] ANN: Leksah 0.10.0

2011-05-02 Thread Mathew de Detrich
I actually agree with you on that regard, I think the best thing you can get from Yi is just the basic editing commands (the same you would get from vim), such as visual/edit mode and whatnot The best thing that Leksah can turn into (and something that Haskell desperately needs) is a Haskell

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread Tony Morris
On 02/05/11 17:54, Ketil Malde wrote: I'm following Harper's blog, Existential Type¹, which I find to be an enjoyable and entertainingly written tirade about the advantages of teaching functional programming - specifically ML - to students. Of course, he tends to be critical of Haskell, but

Re: [Haskell-cafe] Interfacing C++ iterators does not work as expected

2011-05-02 Thread Albert Y. C. Lai
On 11-05-02 05:31 PM, Huynh Huu Long wrote: Big thanks, that works for me as well. Doesn't GHC check whether a type is allowed (like CInt,...) or not (like Bool,...)? No, it doesn't, since version 6.10.1:

Re: [Haskell-cafe] Binary and Serialize classes

2011-05-02 Thread Evan Laforge
I'm a bit skeptical of adding builders for different variable length encodings to the library, simply because there are so many possibilities. I think creating a binary-vle (for variable length encoding) package would be worthwhile. I have an implementation of the VLE used in protocol

[Haskell-cafe] Is Harper right that Haskell cannot model the natural numbers?

2011-05-02 Thread Richard O'Keefe
In one of his blog posts, Robert Harper claims that the natural numbers are not definable in Haskell. SML datatype nat = ZERO | SUCC of nat Haskell data Nat = Zero | Succ Nat differ in that the SML version has strict constructors, and so only finite instances of nat can be constructed,

Re: [Haskell-cafe] Is Harper right that Haskell cannot model the natural numbers?

2011-05-02 Thread Albert Y. C. Lai
On 11-05-02 11:25 PM, Richard O'Keefe wrote: Fair enough, but what about data Nat = Zero | Succ !Nat It works. I say, Harper forgot it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] ANN: Leksah 0.10.0

2011-05-02 Thread Hamish Mackenzie
I did most of the Yi integration work done so far, but I have not had time to work on it lately. Yi already is a library (for dyre) and is designed to work with different front ends. The approach I took was to add a new Pango Control front end based on the existing Pango front end. I think

Re: [Haskell-cafe] Is Harper right that Haskell cannot model the natural numbers?

2011-05-02 Thread Peter Gammie
On 03/05/2011, at 1:25 PM, Richard O'Keefe wrote: In one of his blog posts, Robert Harper claims that the natural numbers are not definable in Haskell. SML datatype nat = ZERO | SUCC of nat Haskell data Nat = Zero | Succ Nat differ in that the SML version has strict constructors,

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread Manuel M T Chakravarty
Tony Morris: Interesting how I have been authoring and subsequently using monads in scala for several years and it is strictness that gets in the way more than anything. Just to make sure that I understand you correctly. You are saying that when you use monads in Scala, then strictness makes

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread Manuel M T Chakravarty
For a historical perspective, I highly recommend The Definitive Account of the History of Haskell: http://research.microsoft.com/en-us/um/people/simonpj/papers/history-of-haskell/index.htm Section 7 clearly and directly cites the desire to have pure I/O as the motivation for adopting