I found a link(http://www.haskellforall.com/2014/03/introductions-to-advanced-haskell-topics.html) from haskelllforall.com earlier and am trying to go through the materials in it. I am now reading the corontine article(http://themonadreader.files.wordpress.com/2011/10/issue19.pdf).
I think the article did a good job explaining what corontine is and how it works. However, i don't think i see the full benefits of coroutine from the article.
I know one usage is that you can stream a list of coroutines together as a data process flow. Because you don't need to hold a lot data in memory this way, data is consumed and send to next 'data processor' immediately, low memory footprint is definitely a benefit. Also, because you don't have to put 'data processor's in different threads, so less context switch will happen. The coroutines just cooperate with each other without any locks/mutexes/etc. That can be another benefit.
But don't we lose some parallelism as a result? If we allow more memory usage, and put processors in different threads. Processor 1 can accumulate some data then pass to processor 2, and while processor 2 is at it, processor 1 can continue to process. In fact, this is how java blocking queue is usually used.
Or maybe coroutines can be used to do this, it's just the pipe functions in the article are just simple implementation to help people understand the concept? If this is true, how are those implemented in a real world?
Also, coroutine seems to be useful in many other cases, can someone list those as well?
I know this is a lot questions..but i really want to understand coroutines, they on their own are very interesting already.submitted by icetortoise
[link] [5 comments]
Is there any consensus as to which of these (or another alternative) is the nicest to use? I don't have any experience with SDL or SFML.submitted by detorid
[link] [13 comments]
cabal-install includes a freeze command these days, which is very helpful to get reproducible builds, especially for executables. See the announcement of cabal 1.20 for more details.
Now, my question: Is there a tool which can tell if/when there are newer versions of cabal frozen dependencies?
I guess one way to achieve this is rebuilding the application in a clean sandbox with no cabal.config and calling cabal freeze again.
However that requires recompiling the universe unnecessarily. I assume packdeps can be extended to support this functionality or cabal-install can itself provide this information.submitted by ozgurakgun
[link] [4 comments]
Hello, I've been recently interested in programs that can program programs for you. That is, you give it a map of input/output pairs and it gives you the source code of a program that is valid for that map. If we had something like that that worked for arbitrary programs, programming would become so much ridiculously easier that the whole field would change. In order to investigate, I made a small program that finds the definition of the (λx -> x+tan(x*x)) function from 20 input/output pairs. I was actually surprised by how fast it could find the result, but, obviously, anything much more complex than that results in a combinatory explosion.
But thinking about it, most of the functions we write in Haskell are really small. Even complex stuff that take hours to get right, such as an interpreter for the lambda calculus, could be written in as few as 3 lines. So this makes me suspect that kind of thing, with some added heuristics (genetic programming?) could actually be useful to practical jobs. So this makes me wonder, why I never heard of it? Has anyone ever tried to use and incorporate this kind of thing in their daily Haskell work? How successful (or not) was it?submitted by SrPeixinho
[link] [8 comments]
Elimination rules play an important role in computations over datatypes in proof assistants like Coq. In his paper "Elimination with a Motive", Conor McBride argued that "we should exploit a hypothesis not in terms of its immediate consequences, but in terms of the leverage it exerts on an arbitrary goal: we should give elimination a motive." In other words, proofs in a refinement setting (backwards reasoning) should use their goals to guide elimination.
I recently had the opportunity to reread this historical paper, and in the process, I thought it would be nice to port the examples to Coq. Here is the result:
It's basically a short tutorial motivating John Major equality (also known as heterogenous equality.) The linked text is essentially an annotated version of the first part of the paper—I reused most of the text, adding comments here and there as necessary. The source is also available at:
Please, don't take it as an offence, but Cabal is terrible as a package manager, it is a serious problem about Haskell and it is about time the community does something to solve this.
I've been trying for months to install GHCJS to no success. Haste, Fay, many other things I try to install end up in a plain failure with terrible error messages that give you no hope to get it right. Getting anything to work with Haskell is a pain and I spent much more time installing and cleaning installs than ever coding on the language. This is completely unacceptable. Coming from Node.js, where npm install lib actually works makes me feel like I'm back to the 90's. You keep asking what is stopping Haskell from getting main adoption, and there it is. This. This is what is stopping it.
I think it is about time we unite ourselves as a community and try to solve the problem by creating an actual package manager for Haskell. And humbling ourselves to learn a lot from Node.js.submitted by SrPeixinho
[link] [27 comments]
Could someone provide a shell script that will clean any existing Haskell installation and install GHC 7.8 and GHCJS in OSX Mavericks?
As some might even know, I've tried installing GHCJS 7.8 on OSX several times already. I've even asked this a few times here to no luck. So now what I am asking is, could someone write a sh script that will do all I need - cleaning any existing Haskell and setting GHC 7.8 with working GHCJS up on OSX? That would be really great. :(submitted by SrPeixinho
[link] [5 comments]