I wrote a small utility that displays project structure visually (think tree mixed with ag) and I'd appreciate criticism. https://github.com/hakujin/leaves
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 https://github.com/Valloric/YouCompleteMe; 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_
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:
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:
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:
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:
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.)
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]
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]
http://www.haskell.org 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 mail.haskell.org. 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 https://wiki.haskell.org 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 firstname.lastname@example.org, 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]
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]
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]