Gauge it on my understanding of this article. My personal assessment is that I understand it well enough to explain to a non programmer exactly as it works. http://www.smashingmagazine.com/2014/07/02/dont-be-scared-of-functional-programming/submitted by Franks_Wild_Years
[link] [7 comments]
@fsibot inspired me to make a haskell version.
I used mueval (from lambdabot in the irc channel), twitter-conduit and acid-state to keep track of which tweets it has replied to.
The code is on github: https://github.com/ashyisme/lambdatwit
Give it a try, tweet something like: "@LambdaTwit map (* 2) [1..10]"
There's an issue currently where unicode strings seems to crash the bot, I haven't worked out what is causing this yet. Lambdabot in the irc channel can handle unicode fine so I must have messed something up with how I'm calling mueval.submitted by LiveRanga
[link] [6 comments]
My previous exposure to functional languages is with Scheme, wherein it is quite common to introduce sugar by showing how to write it yourself. I find this useful, because it teaches you what are the really fundamental syntactical aspects of the language, and which parts are flexible, or just a kind of short hand. (E.g., in Scheme it is not uncommon to find instructions relatively early on about how one writes a macro to define if using cond). In Haskell, syntactic forms like multiple function clauses, guards, case expressions, and conditions all of some overlapping aspects, but they also all seem function a little bit different and call for their own syntactic rules. I'd love to find a resources that will tell me what the basic idiom at work is, and maybe show me how you can reconstruct, or mimic the various derivations using that foundation. (Of course, I'm not expecting an equivalent of macros, just some insight into the desugared logic).
Thanks in advance for any pointers!submitted by abathologist
[link] [9 comments]
We present a complete polymorphic effect inference algorithm for an ML-style language with handlers of not only exceptions, but of any other algebraic effect such as input & output, mutable references and many others. Our main aim is to offer the programmer a useful insight into the effectful behaviour of programs. Handlers help here by cutting down possible effects and the resulting lengthy output that often plagues precise effect systems. Additionally, we present a set of methods that further simplify the displayed types, some even by deliberately hiding inferred information from the programmer.
After far too long, and far too many obstacles to be overcome, Dave MacQueen, Lars Bergstrom, and I have finally prepared an open-source site for the entire family of languages derived from Standard ML. The defining characteristic of Standard ML has always been that it has a mathematically precise definition, so that it is always clear what is a valid program and how it should behave. And indeed we have seven different working compilers, all of which are compatible with each other, with the exception of some corner cases arising from known mistakes in the definition. Moreover, there are several active projects developing new variations on the language, and it would be good to maintain the principle that such extensions be precisely defined.
To this end the sources of the 1990 and 1997 versions of the definition are on the web site, with the permission of MIT Press, as is the type-theoretic definition formulated by Chris Stone and me, which was subsequently used as the basis for a complete machine-checked proof of type safety for the entire language done by Karl Crary, Daniel K. Lee. It is be hoped that the errors in the definition (many are known, we provide links to the extensive lists provided by Kahrs and Rossberg in separate investigations) may now be corrected by a community process. Anyone is free to propose an alteration to be merged into the main branch, which is called “SML, The Living Language” and also known as “Successor ML”. One may think of this as the third edition of the definition, but one that is in continual revision by the community. Computer languages, like natural languages and like mathematics, belong to us all collectively, and we all contribute to their evolution.
Everyone is encouraged to create forks for experimental designs or new languages that enrich, extend, or significantly alter the semantics of the language. The main branch will be for generally accepted corrections, modifications, and extensions, but it is to be expected that completely separate lines of development will also emerge.
The web site, sml-family.org is up and running, and will be announced in various likely places very soon.
Update: We have heard that some people get a “parked page” error from GoDaddy when accessing sml-family.org. It appears to be a DNS propagation problem.
Update: The DNS problems have been resolved, and I believe that the web site is stably available now as linked above.
Filed under: Research Tagged: functional programming, sml
hi i made haskell in snake! i mean...
at the moment its like 170 lines and i'd love to see if anyone can make it shorter, more mathematically sound and or prettier. maybe i need a cabal file? i honestly don't know what i'm doing. someone on #haskell said something about golf.
anyway, this is the first thing i've written in haskell so there is likely lots to fix so here is the repo : )submitted by becky-conning
[link] [42 comments]
Summary: I've just released ghcid, which interactively shows the errors in your project on each save.
I'm please to announce ghcid, which is either "GHCi as a daemon" or "GHC + a bit of an IDE". I've been using it for my development for the last few days, and already find it quite valuable. Unlike other Haskell development tools, ghcid is intended to be incredibly simple. In particular, it doesn't integrate with any editors, doesn't depend on GHC the library and doesn't start web servers. It's under 200 lines of fairly dull Haskell, which talks over pipes to your existing ghci.
Run cabal update && cabal install ghcid to install it as normal. Then run ghcid --height=10 "--command=ghci Main.hs". The height is the number of lines you are going to resize your console window to (defaults to 8), and the command is how you start this project in ghci. Personally, I always create a .ghci file at the root of all my projects, which usually reads something like::set -fwarn-unused-binds -fwarn-unused-imports
With that you can pass --command=ghci (or nothing, since that is the default).
After that, resize your console and make it so you can see it while working in your editor. On Windows the ghcid console will automatically sit on top of all other windows. On Linux, you probably want to use your window manager to make it topmost or use a tiling window manager.
What you get
On every save you'll see a list of the errors and warnings in your project. It uses a single ghci under the hood, so even relatively large projects should update their status pretty quickly. As an example:Main.hs:23:10:
Not in scope: `verbosit'
Perhaps you meant `verbosity' (imported from System.Console.CmdArgs)
Util.hs:18:1: Warning: Defined but not used: `foo'
Or, if everything is good, you see:All good
This project is only a few days old, so please report any bugs you find.
What you want
I regularly use an IDE to develop in a Haskell-like language. I find that with the IDE I'm about 25% more productive than without it. While an IDE can provide lots of neat features (go to definition, search, type tooltips) I think most of the productivity gains come from:
- Syntax coloring.
- A list of errors and warnings...
- ...which is updated as you type...
- ...and are highlighted in the text (red squiggles).
Every text editor already provides syntax coloring. With ghcid you get the list of errors and warnings. To get the final two features you need to integrate with an editor. I'm hoping that ghcid can do some of the heavy lifting by taking a directory of files to treat as overrides, and producing a list of warnings/errors to a file. The rest is editor specific, and I hope to attempt integration with Sublime Text at some point (although would love some help).
I remember when I first went to University, coming across people who were both clearly extremely expert in their fields, from whom I wanted to learn, but were also religious, and how this utterly baffled me. At that point I would cheerfully describe myself as an avid atheist. My ignorance and naivety was somewhat extensive.
Over a decade later I like to think I have a more nuanced view. The most recent war in Gaza led, obviously, to vast amounts of suffering but some excellent articles on the subject (this one by Hadley Freeman in particular) helped me see perspectives more clearly and articulated how crucial it is to be precise with criticism: are you criticising a religion, a people, a government, a policy or something else? Nothing is ever black-and-white and it seems increasingly important to anticipate the consequences of an ill-thought-through comment or reaction. A good example of that is George Galloway's comments this week in the debate about this country once again getting involved in Iraq. On the face of it, and certainly without being remotely well-enough informed to evaluate the accuracy of his claims, if his claims on the size and makeup of ISIS/ISIL are true then there seems little likelihood that the bombing campaigns being discussed will be effective, and quite likely counter-productive. But all of that got lost due his description of Iraqis as quiescent. The way in which that description was seized upon by other MPs and the resultant media storm resulted in the over-shadowing not just of the rest of his contribution to the debate, but also of other important aspects of the debate, such as the resignation of Rushanara Ali (Labour's Shadow Minister for Education), citing once again the lack of a credible long-term plan for the region and our involvement.
Addressing the broader and somewhat more abstract issue is this enlightening article by Karen Armstrong. Again, I'm not claiming to be expert in the area, merely I found the article very educative. It had barely occurred to me that the western world's separation of the secular from the sacred was firstly such a recent occurrence, and secondly that it arose from a specific set of circumstances. There is no implicit reason why separation of state from church is an inevitable or even likely happenstance (to me, this reminds me of the question "if humans evolved from monkeys, then why can't we find monkeys still evolving into humans today?", to which the answer is "the circumstances are not right for that to occur"). The fact that the English word "religion" can't really be translated accurately into other languages (especially not languages that predate English such as Greek or Latin; as historically faith is all encompassing of life, not merely a private affair as we treat it today in the west) starts to show quite how odd the separation of secular from sacred in the modern west really is.
More interesting still is the observation that in the west, belonging to a Nation has in some ways subsumed the role of belonging to a Religion, only apparently with more positive overtones: we consider it almost reprehensible to die for your religion, but honourable to die for your nation. It would seem the concept of even belonging to a nation and having any sense of greater community outside your immediate surroundings only came about with the increased ability of governments to engage with (or intrude upon) their citizens. Before that point, presumably with church attendance widespread and frequent, one's interaction with "the wider world" was through the representative of the church. This would seem to explain a lot about why governments of the past sought the blessing of their nation's church for particular courses of action: maybe the church was seen as the bridge between the government (or monarchy) and the people. The whole article is worth a read.
Just installed the Haskell, Emacs and Haskell-mode. And I tried using C-c C-l to load my .hs file into GHCi but when I do I get this message:
"haskell-mode-enable-process-minor-mode: You tried to do an interaction command, but an interaction mode has not been enabled yet."
Any help??submitted by willrobertshaw
[link] [11 comments]