News aggregator

Request for review

Haskell on Reddit - Sun, 02/15/2015 - 4:01pm

I wrote a small utility that displays project structure visually (think tree mixed with ag) and I'd appreciate criticism.

Known deficiencies are very crude parsing of .gitignore/.hginore files and that the Tree filesystem structure is built fully in memory before being rendered to the screen. Profiling shows reasonable performance on average with the degenerate case being a large number of top-level ignore patterns with deep subtrees (git clone; cd YouCompleteMe; git submodule init --recursive; leaves); regex-tdfa matching occupies the overwhelming majority of time. ag handles this worst-case situation with more grace so there is clearly room for improvement.

I want to continue learning and welcome any commentary (including more appropriate venues for criticism). Thanks in advance.

submitted by hakujin_
[link] [comment]
Categories: Incoming News

Ketil Malde: Thoughts on phylogenetic trees

Planet Haskell - Sun, 02/15/2015 - 2:00pm

An important aspect of studying evolution is the construction of phylogenetic trees, graphically representing the relationship between current and historic species. These trees are usually calculated based on similarities and differences between genetic material of current species, and one particular challenge is that the topology of the resulting trees depend on the selection of genes used to construct them. Quite often, the species tree based on one set of genes differ substantially from the tree based on another set of genes.

The phylogenetic tree is usually presented as a simple tree of species. The end points of brances at the bottom of the tree (leaves) represent current species, and branching points higher up (internal nodes) represent the most recent common ancestor, or MRCA, for the species below it.

A very simple example could look something like this:

Evolution as a tree of species

Here you have two current species, and you can trace back their lineage to a MRCA, and further back to some ancient origin. Varying colors indicate that gradual change along the branches has introduced differences, and that the current species now have diverged from each other, and their origin.

This representation has the advantage of being nice and simple, and the disadvantage of being misleading. For instance, one might get the impression that a species is a well-defined concept, and ask questions like: when the first member of a species diverged from its ancestor species, how did it find a mate?

Species are populations

But we are talking about species here - that is, not individuals but populations of individuals. So a more accurate representation might look like this:

Evolution as a tree of populations

Circles now represent individuals, and it should perhaps be clearer that there is no such thing as the “first” of anything. At the separation point, there is no difference between the two populations, and it is only after a long period of separation that differences can arise. (Of course, if there are selective pressure favoring specific properties - perhaps redness is very disadvantageous for species B, for instance - this change will be much quicker. Look at how quickly we have gotten very different breeds of dogs by keeping populations artificially separate, and selecting for specific properties.)

The so-called “speciation” is nothing more than a population being split into two separate parts. Typically, this can be geographically - a few animals being carried to Madagascar on pieces of driftwood - but anything that prevents members of one branch from mating with members of the other one will suffice. At he outset, the two branches are just indistinguishable subpopulations of the same species, but if the process goes on long enough, differences between the two populations can become large enough that they can no longer interbreed, and we can consider them different species.

In practice, such a separation is often not complete, some individuals can stray between the groups. In that case, speciation is less likely to happen, since the property of being unable to breed with the other group represents a reproductive disadvantage, and it would therefore be selected against. In other words, if your neighbor is able to have children with more members of the population than you, his chances of having children are better than yours. Your genes get the short end of the stick. Kind of obvious, no?

Populations consist of genes

But we can also view evolution as working on populations, not of individuals, but of individual genes. This is illustrated in the next picture:

Evolution as a tree of gene populations

The colored circles now represent genes, and an individual is here just a sample from the population of genes - illustrated by circling three gene circles. (Note that by “gene”, we here mean an abstract unit of inheritance. In other fields of biology, the word might be synonymous with a genetic region that codes for a protein, or is transcribed to (possibly non-coding) RNA.)

Here, we see that although the genes themselves do not change (in reality they are subject to mutations), the availability of the different genes vary over time, and some might disappear from one of the branches entirely - like red genes from species B here. This kind of genetic drift can still cause distinct changes in individuals.

Ancestry of individual genes

Each individual typically gets half its genes from each parent, one fourth from each grandparent, and so on, so after a few generations, all genes come from essentially different ancestors. This means you can calculate the MRCA for each gene individually, and this is exactly what has been done to estimate the age our “mitochondrial Eve” and “Y-chromosomal Adam”. Here is the example lineage for the green gene:

Lineage and MRCA for the green gene

We see that the green-gene MRCA is much older than the speciation event. In addition, each gene has its unique history. This means that when we try to compute the MRCA, different genes will give different answers, and it can be difficult to construct a sensible consensus.

For example, bits of our genome appear to come from the Neanderthal, and those bits will have a MRCA that predates the time point where Neanderthal branched from H. sapiens (possibly 1-2 million years ago). (Interestingly, “Adam” and “Eve” are both estimated to have lived in the neighborhood of 200000 years ago. This means that although 20% of the Neanderthal genome is claimed to have survived, all Neanderthal mitochondria and Y-chromosomes have been eradicated.)

Categories: Offsite Blogs

Picking your Prelude

Haskell on Reddit - Sun, 02/15/2015 - 12:46pm

There have been many debates recently about fundamentally changing the Prelude. I am going to ignore all specifics and simply ask the following question: why don't we support multiple Preludes? Of course not for everyday switching, but for forward compatibility and project-wide semantic stuff. I'm thinking the new standard practice would be to add a "no implicit prelude" pragma and then manually "import FAMPrelude" or "import GenericPrelude" whatever version you want.

First, the cons. Please feel free to add more. If different people use different preludes, it will dramatically reduce the predictability of Haskell source files. People could think a beloved function behaves one way when it really doesn't. (But if they see the prelude used at the top, at least they have somewhere to go look things up). People would probably be tempted to bloat their own preludes with their favorite functions from data.list or whatever. (Perhaps people should be discouraged from writing their own preludes and all variations should come from GHC).

Now, pros. Forward compatibility is the main thing I'm thinking of. Today, we're debating over a particular typeclass structure, but there's no telling what change could be proposed tomorrow. If we support multiple prelude, old code can still work with its implicit prelude, yet new code can be freed from historical mistakes. Second, there are functions I use in every single source file (namely x -$ f = f x and f -. g = g . f) simply because I code in a particular style. Companies should all use the same prelude, whichever fits best for the style they want to code with.

I suppose most of this is already possible (with such projects as the numeric prelude, which in my opinion is too vast of a change for what I am proposing). However, what I would really like is for GHC to support multiple preludes as our knowledge evolves and our tastes change.

submitted by AlephOmega1
[link] [24 comments]
Categories: Incoming News

Ideas for an opensource project

Haskell on Reddit - Sun, 02/15/2015 - 10:05am

We're a bunch of Haskell enthusiasts that get together weekly to talk about and discuss all things Haskell. It's a small group for now. But we anticipate it growing larger in the near future. And as the group becomes bigger, we'll have folks with varying skill levels. Beginner to Advanced.

We would like to get started with some opensource idea. Something that we can implement in Haskell, and learn as we go. Something that would allow us to participate in a coding marathon of a few hours every weekend or so and be able to see some measureable progress. Being able to measure the progress is important so that we can feel motivated to carry on.

So far we've thought about, * a docker web frontend to manipulate containers and visualize connections between containers * a haskell version of "pydoc". basically a documentation server that serves documentation of the packages installed in your sandbox.

There were a few other ideas thrown around. But the ones mentioned above were noteworthy.

What we would like to know is if there is any other idea worth pursuing/considering? Anything, that the haskell community would like, that does not exist at the moment, perhaps!.

submitted by desijays
[link] [16 comments]
Categories: Incoming News

ANN: New Homepage Now Live

haskell-cafe - Sun, 02/15/2015 - 9:50am
I’m pleased to announce that has received its first significant design update since 2010! More significantly, for the first time since 2006 it is not a wiki, but an actual language homepage. More significantly still, for the first time ever, the Haskell homepage now runs on a fully Haskell-powered stack. I suppose some people might also be interested in the fact that it looks quite nice, and has significantly cleaned up the information it presents, so as to provide a more focused experience for newcomers looking to explore the language. The page is now includes the collective work of over 230 commits by 17 contributors. First and foremost among those is Chris Done, who conceived the vision, wrote the bulk of the code, and executed the design. Also thanks to our many admins, including Austin Seipp, Ricky Elrod, et al., who managed the deployment, and have been working behind the scenes to continue to modernize and update our creaking infrastructure. Onto a few key things to remember
Categories: Offsite Discussion

Code review. API Guidance.

haskell-cafe - Sun, 02/15/2015 - 3:54am
Hello everyone. I have an application (a calculator repl [1]) and I'm looking to convert it into an package that provides both library and executable. I'm looking for suggestions for what might be a good API for such a library. I'm not looking for an extended code review, just the placement of functions in modules, and which functions to export. The current source tree looks like this. src/ $ tree . . ├── Calculator │ ├── Color.hs -- Colored output │ ├── Evaluator │ │ ├── Base.hs -- Common evaluation functions │ │ ├── Cmd.hs -- Evaluate special commands │ │ ├── Expr.hs -- Expression evaluation │ │ ├── Func.hs -- Convert specification for a function into a mathematical function │ │ └── Statement.hs -- Evaluate either expression or command │ ├── Help.hs -- Help message │ ├── Parser │ │ ├── Bas
Categories: Offsite Discussion

Exception safe resource management with dynamic regions, call for review

haskell-cafe - Sat, 02/14/2015 - 11:36pm
Hello, I'm asking for code and design review for `io-region` library. It is already on Hackage for convenience and easy access to haddock: Manual exception handling in Haskell almost never is a good idea, except probably trivial cases where `bracket` is enough. A number of special libraries where created to help with exception handling. `io-regions` is one of them. Initially it was an attempt to solve the double-throw issue, but I found it unsolvable in library without changes in language itself. So now it is an attempt to design easy to use API with a bit different set of trade-offs. The library is based on idea of regions that own resources. The resources are released when the region is closed. Early releasing and ownership transferring are supported. Types are *not* used to prevent use-after-free errors. The API is not monadic, and it is the biggest difference from other libraries. Regions are first-class citizens, so you can manipulate them, pass as arg
Categories: Offsite Discussion

New Haskell Homepage is Live

Haskell on Reddit - Sat, 02/14/2015 - 10:55pm finally has the result of the design that Chris Done first proposed last May. If you do not yet see it, the DNS should propagate soon, and then you will.

I think it looks pretty cool. There has been a long period of asking for feedback and pull-requests (you can find a link to the github repo at the bottom of the page). The page is now includes the collective work of 260 commits by 16 contributors. Thanks to everyone who tested it, commented on it, patched it, and otherwise helped get us to this point!

We imagine that now that this is the new official page, there will be more pull requests and issues, and the page will get even better. Note there is an issue tracker associated with the github repo, so we can log anything anyone wants to raise.

A lot of the work by our crack (but beleaguered) admin team has been in making sure all the "other stuff" transitions smoothly. So there are many subdirs like /ghc and they all should still work. If they don't, please let us know. Mailing lists have been moved to a new home at Redirects should be in place, and everything should work as before. If it doesn't, let us know.

If you're missing the old content -- it is all still there at and one of our first orders of business will be making it more prominent from the new page too.

As always, the way to contact your friendly neighborhood admin team is, or the #haskell-infrastructure channel on freenode, or -- in this case -- file a ticket (or better yet a pull request) on github.

submitted by gbaz1
[link] [116 comments]
Categories: Incoming News

ANN: ZuriHac 2015

haskell-cafe - Sat, 02/14/2015 - 10:15pm
We am glad to announce ZuriHac 2015, a annual three-day Haskell hackathon in Zurich. This year it's sponsored by Google. When: May 29th - May 31st Where: Google office, Zurich, Switzerland ZuriHac is an international Haskell hackathon: a grassroots, collaborative coding festival with a simple focus, to build and improve Haskell libraries, tools, and infrastructure. This is a great opportunity to meet your fellow Haskellers in real life, find new contributors for your project, improve existing libraries and tools, or even start new ones! I am happy to announce that Edward Kmett will give a talk. We are still in progress of nailing down the details, they will be available at the wiki page: Registration is not yet open, we will send an additional announcement email when it's open. We look forward to seeing you there!
Categories: Offsite Discussion

Inspecting functions

Haskell on Reddit - Sat, 02/14/2015 - 6:25pm


I dabble with Haskell every now and then and was wondering if anyone could suggest a good way to inspect the content of a function. C# has a system called an expression tree wherein a lambda expression is automatically converted by the compiler into a tree of objects, which can be inspected to generate code for other systems such as SQL in the case of Entity Framework; record => record.X > 3 && record.Y < 4 compiles to something like: And ( GreaterThan ( Member ( Parameter "record" ) "X" ) ( Constant 3 ) ) ( LessThan ( Member ( Parameter "record" ) "Y" ) ( Constant 4 ) ) which can be recursed to make a SQL query like: WHERE (X > 3) AND (Y < 4)

I see people making types which appear to work in a similar way, but this seems to me as though it would limit the flexibility and ease of use of "proper" functions; things like scope would be much harder to do.

My particular use case is that I have fairly complex distance field functions currently written as C# expressions which I want to be able to compute both on the CPU for physics and on the GPU for rendering as GLSL. I currently have a (quite shaky) proof-of-concept in C# but was wondering if Haskell could do this in another way.

Thank you.

submitted by JamesWildDev
[link] [5 comments]
Categories: Incoming News

How should I indent my code in Emacs?

Haskell on Reddit - Sat, 02/14/2015 - 3:59pm

I've been struggling with this ever since I started, and the more I try to configure my Emacs config, the worse it gets.

I've tried using hident, but out of the three available styles only the gibiansky one seems to work for the kind of code I write (the others split expressions way too much), but it still kills all the whitespace I've intentionally added, so I only rarely use it.

Out of the three indentation modes in Emacs, haskell-indent-mode, haskell-indentation-mode and haskell-simple-indent-mode, I can't find one that would just work. Most of the time I stick with haskell-indentation-mode, but recently it seems as if it went crazy and started indenting things differently.

Now I understand that it is really difficult to get indentation right in a language like Haskell, but I'm not looking for something to re-format my code, I only want proper indentation.

What do you guys use for indenting your Haskell code?

submitted by progfu
[link] [14 comments]
Categories: Incoming News

Changes to Haskell Weekly News: In with the Old,In with the New

haskell-cafe - Sat, 02/14/2015 - 3:56pm
Dear Reader, A few days ago Daniel Santa Cruz stepped down from the helm of Haskell Weekly News. With others that read HWN regularly, I thank him for his long service and wish him and his family godspeed. Did you know John Goerzen started HWN in August 2, 2005? Now a week from today, February 21, 2015, Simon and Simon shall close your window of opportunity to opine on drastic changes to the prelude. By sheer coincidence, the very first issue of HWN links to a thread on Updating the Haskell Standard. John himself started the thread. Today the talk is about the Foldable and Traversable type classes. Back then it was about Overlapping and Undecidable instances, the FFI, and a Hierarchical namespace. But these are all features we take for granted today. What sweeping changes took hold over the last ten years. There was no hackage. Only in September 2005 did Isaac Jones and David Himmelstrup announce beta-testing of a cabal prototype. Imagine life without hackage. Today there are 7664 packages all ready to
Categories: Offsite Discussion

ANN: ZuriHac 2015

Haskell on Reddit - Sat, 02/14/2015 - 2:43pm
Categories: Incoming News