News aggregator

I have created... dumb sort.

Haskell on Reddit - Wed, 09/17/2014 - 2:47pm
atBeginning xs x = uncurry (++) $ partition (==x) xs dumbSort xs = foldl atBeginning xs [maximum xs, maximum xs - 1..minimum xs]

Efficient on lists of small numbers!

submitted by Undo_all
[link] [2 comments]
Categories: Incoming News

Philip Wadler: The military and the referendum.

Planet Haskell - Wed, 09/17/2014 - 2:42pm

Many readers will have heard about Lord Dannat in the Telegraph arguing a vote for independence will dishonour Scotland's war dead.

Perhaps not as many will have heard that Jimmy Sinclair (the oldest surviving Desert Rat, aged 102), Colin May (Lieutenant Commander, Faslane), and sixteen others have written a letter slamming Dannat; at least, I didn't hear until this morning. "How dare he take their sacrifice in vain and try to turn it to political advantage?"

Both sides are reported by the BBC, though the headline mentions only one. (More #bbcbias?)

Categories: Offsite Blogs

Eric Kidd: Deploying Rust applications to Heroku, with example code for Iron

Planet Haskell - Wed, 09/17/2014 - 2:35pm

Now with support for Iron, Cargo and Cargo.lock!

You can deploy an example Rust application to Heroku using this button:

If you'd prefer to use the command line, you'll need git and the Heroku toolbelt. Once these are installed, run:

git clone https://github.com/emk/heroku-rust-cargo-hello.git cd heroku-rust-cargo-hello heroku create --buildpack https://github.com/emk/heroku-buildpack-rust.git git push heroku master

This will download the example application, create a new Heroku project, and deploy the code to Heroku. That's it!

How it works

Our server is based on the Iron middleware library. We parse URL parameters and dispatch HTTP requests to the appropriate handler routine using Iron's router module:

fn main() { let mut router = Router::new(); router.get("/", hello); router.get("/:name", hello_name); Iron::new(router).listen(Ipv4Addr(0, 0, 0, 0), get_server_port()); }

The hello function returns an HTTP status code and the content to send to the user:

fn hello(_: &mut Request) -> IronResult<Response> { Ok(Response::with(status::Ok, "Hello world!")) }

The hello_name function is similar, but we look up the value of the :name parameter that we declared to the router, above.

fn hello_name(req: &mut Request) -> IronResult<Response> { let params = req.extensions.find::<Router,Params>().unwrap(); let name = params.find("name").unwrap(); Ok(Response::with(status::Ok, format!("Hello, {}!", name))) }

The final piece needed to run on Heroku is a function to look up up our port number:

fn get_server_port() -> Port { getenv("PORT") .and_then(|s| from_str::<Port>(s.as_slice())) .unwrap_or(8080) }

The full source code is available on GitHub. To learn more about Rust, see the excellent Rust guide.

Keep reading for notes on building the program locally and on configuring your own programs to run on Heroku.

Read more…

Categories: Offsite Blogs

Philip Wadler: The case for Europe

Planet Haskell - Wed, 09/17/2014 - 2:10pm
<iframe frameborder="0" height="500" src="http://www.bbc.co.uk/emp/embed/smpEmbed.html?playlist=http%3A%2F%2Fwww.bbc.co.uk%2Fiplayer%2Fplaylist%2Fp026txk6&amp;title=Today%3A%2017%2F09%2F2014%3A%20Salmond%20promises%20%22common-sense%20agreement%20on%20a%20common%20currency%E2%80%9D&amp;product=iplayer" width="400"></iframe>
Readers of this list will know that I don't always see eye-to-eye with Alex Salmond. Nonetheless, I think he put the case for Europe well this morning on the Today Program.In a BBC interview just the other night, a spanish minister being
interviewed by Kirsty Wark despite being invited three or four times
refused to say that Spain would attempt to veto Scottish
membership. And the reason for that of course is that the Spanish
government have already said that in the circumstance of a consented
democratic referendum, as they put it, Spain would have nothing to say
about it.

We can go through legal opinion and expert opinion as much as we like.
I think the answer is in four figures: 1, 20, 25, and 60.

1% is the percentage of Scotland's population compared to the European Union.

20% is the percentage of the fish stocks of the entire European Union.

25% is the percentage of the renewable energy of the entire European Union offshore.

And 60% is the oil reserves that Scotland has.

Anyone who believes that a country [with these resources] is not
going to be welcome in the wider Europe doesn't understand the process
by which Europe accepts democratic results and that Scotland has a
huge amount of attractiveness to the rest of the European continent.
You can hear the original here, the relevant segment starts at around 8:00.
Categories: Offsite Blogs

Fairly small projects (~1 to 7 days) to do and learn from?

Haskell on Reddit - Wed, 09/17/2014 - 12:39pm

I recently started using haskell and it's quickly become my favorite language. Unfortuantly, I have nothing to apply it to. What are some small projects I can do for fun and to practice my skills?

submitted by Undo_all
[link] [18 comments]
Categories: Incoming News

Injective type families for GHC - syntax proposals

haskell-cafe - Wed, 09/17/2014 - 12:10pm
Haskellers, there is some discussion going on at the moment about implementing injective type families in GHC [1]. I'd like to hear your opinions on proposed syntax for this new feature. == Problem == Currently GHC assumes that type families are not injective. This is of course conservative and the idea behind implementing injective type families is to allow the programmer to explicitly declare that a type family has the injectivity property (which GHC will of course verify). == Forms of injectivity == Injectivity can take forms more complicated than just determining the LHS from RHS: A. RHS determines all arguments on the LHS. Example: type family Id a where Id a = a Here the RHS uniquely determines LHS. B. RHS determines some but not all arguments on the LHS. Example (contrieved): type family G a b c where G Int Char Bool = Bool G Int Char Int = Bool G Bool Int Int = Int Here RHS uniquely determines `a` and `b` but not `c`. C. RHS and some LHS ar
Categories: Offsite Discussion

ANN: HacBerlin - Haskell Hackathon in Berlin,26-28 Sep 2014

General haskell list - Wed, 09/17/2014 - 10:01am
Hi everyone, this is just a quick reminder: The Haskell Hackathon in Berlin starts in 9 days and there are very few places left. Please register now: http://goo.gl/aLfnWu Where: Berlin, Germany When: Fri 26 - Sun 28 September 2014 We will do lots of Haskell hacking and listen to two excellent talks: * Beyond Parsec -- Revisiting Parser Combinators, by Andres Löh * Chordify: Advanced Functional Programming for Fun and Profit, by José Pedro Magalhães Meet in Berlin, discuss, hack together and improve the Haskell infrastructure. We welcome all programmers interested in Haskell, beginners and experts! For all details, visit our wiki page (http://www.haskell.org/haskellwiki/HacBerlin2014) and make sure to register now! Cheers, Stefan
Categories: Incoming News

ANN: HacBerlin - Haskell Hackathon in Berlin,26-28 Sep 2014

haskell-cafe - Wed, 09/17/2014 - 10:01am
Hi everyone, this is just a quick reminder: The Haskell Hackathon in Berlin starts in 9 days and there are very few places left. Please register now: http://goo.gl/aLfnWu Where: Berlin, Germany When: Fri 26 - Sun 28 September 2014 We will do lots of Haskell hacking and listen to two excellent talks: * Beyond Parsec -- Revisiting Parser Combinators, by Andres Löh * Chordify: Advanced Functional Programming for Fun and Profit, by José Pedro Magalhães Meet in Berlin, discuss, hack together and improve the Haskell infrastructure. We welcome all programmers interested in Haskell, beginners and experts! For all details, visit our wiki page (http://www.haskell.org/haskellwiki/HacBerlin2014) and make sure to register now! Cheers, Stefan
Categories: Offsite Discussion

[ANN] BOB 2015: Call for Contributions

General haskell list - Wed, 09/17/2014 - 9:41am
Here's a quick reminder. The Deadline for BOB 2015 is in about two weeks (30 September 2014). The BOB conference will have a strong focus on functional programming, so Haskell submissions are very welcome. Please consider submitting! BOB Conference 2015 Berlin 23.1.2015 http://bobkonf.de/2015/ CALL FOR CONTRIBUTIONS English: http://bobkonf.de/2015/cfp.html German: http://bobkonf.de/2015/cfp.html Deadline: September 30, 2014 You drive advanced software engineering methods, implement ambitious architectures and are open to cutting-edge innovation? Attend this conference, meet people that share your goals, and get to know the best software tools and technologies available today. We strive to offer you a day full of new experiences and impressions that you can use to immediately improve your daily life as a software developer. If
Categories: Incoming News

Using Haskell to study provability logic?

Haskell on Reddit - Wed, 09/17/2014 - 8:09am

This is kind of an open-ended question.

I'm trying to figure out if this proof of Löb's theorem can be translated into Haskell step by step. The idea was inspired by sigfpe's post. Unfortunately he used the Functor type class, whose law (a→b)→(□a→□b) isn't valid in modal logic. I'm trying to fix that drawback and use the correct law □(a→b)→(□a→□b) instead.

Here's a tentative type signature for what I want:

class Prov p f where mp :: p (a -> b) -> p a -> p b dup :: p a -> p (p a) fix :: p (f a -> a (f a)) unfix :: p (a (f a) -> f a) loeb :: Prov p f => p (p a -> a) -> p a loeb = ???

The idea is to use p as the provability predicate, and f as the fixpoint operator. Note that there's no method with type a -> p a, because not all true sentences are provable. If we had such a method, the problem would be much easier.

Trying to implement that, I ran into a few difficulties:

1) Haskell doesn't have type-level lambdas, so fix and unfix can only be used with newtypes. That requires adding more methods to Prov, for packing and unpacking every single newtype. I wish there was a better way.

2) The methods of Prov don't seem to be enough. It looks like I need versions of dup and mp that work inside p as well. Is there a workaround?

3) Using f seems like a hacky approximation to the diagonal lemma. Can we do better?

I guess I'm just confused overall. Is it even feasible to use such a direct encoding for modal logics, like provability logic? Or should I go lower level and define explicit types for sentences, proofs, etc.?

submitted by want_to_want
[link] [25 comments]
Categories: Incoming News

a question about cabal files

haskell-cafe - Wed, 09/17/2014 - 4:41am
Hi cafe, I'm developing a library. In this package, some tools for development are included. I would like to compile these tools when I'm developing but I don't want users to compile them. Are there any ways to express such modes in cabal files? ("Executable" cannot be located under "if".) Or should I prepare a separated package for the development tools? Regards, --Kazu
Categories: Offsite Discussion

Towards Shake 1.0

Haskell on Reddit - Wed, 09/17/2014 - 4:00am
Categories: Incoming News

Ivory - index

del.icio.us/haskell - Wed, 09/17/2014 - 1:00am
Categories: Offsite Blogs

What's in store for the most widely used language by discerning hackers?

Lambda the Ultimate - Tue, 09/16/2014 - 11:14pm

Or, in other words, what's the future of Emacs Lisp (and unavoidable HN discussion).

The original message contains some interesting tidbits. I am not sure how the discussion on emacs-devel will develop. But speculating about things such as Guile elisp is, of course, our bailiwick.

Categories: Offsite Discussion