News aggregator

[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 CALL FOR CONTRIBUTIONS English: German: 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 - 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

Security with 'cabal install'

Haskell on Reddit - Tue, 09/16/2014 - 10:47pm

Are hackage packages signed? Does cabal download packages via http or https?

submitted by MintyGrindy
[link] [11 comments]
Categories: Incoming News

LPNMR 2015 - Preliminary Call for Papers - 13th International Conference on Logic Programming and Non-monotonic Reasoning

General haskell list - Tue, 09/16/2014 - 10:00pm
[apologies for any cross-posting] Call for Papers --------------------------------------------------------------------------- 13th International Conference on Logic Programming and Non-monotonic Reasoning LPNMR 2015 Lexington, KY, USA September 27-30, 2015 (Collocated with the 4th Conference on Algorithmic Decision Theory 2015) --------------------------------------------------------------------------- AIMS AND SCOPE LPNMR 2015 is the thirteenth in the series of international meetings on logic programming and non-monotonic reasoning. LPNMR is a forum for exchanging ideas on declarative logic programming, non-monotonic reasoning, and knowledge representation. The aim of the conference is to facilitate interactions between researchers and practitioners interested in the design and
Categories: Incoming News

Mike Izbicki: Beginner error messages in C++ vs Haskell

Planet Haskell - Tue, 09/16/2014 - 6:00pm
Beginner error messages in C++ vs Haskell posted on 2014-09-17 by Paul Starkey

Learning Haskell was excruciating. The error messages from the Haskell compiler ghc were way more difficult to understand than the error messages I was used to from g++. I admit I’m still a novice programmer: My only experience is a year of classes in C++ programming. But the Haskell compiler should do a better job generating error messages for beginners like me.

First we’ll see four concrete examples of ghc doing worse than g++, then Mike will talk about some ways to fix ghc’s error messages.

Example 1

Below are two equivalent C++ and Haskell programs. I’ve intentionally added some syntax errors:

/* C++ Code */ #include <iostream> using namespace std; int main () { int in = -1; cout << "Please choose 1 for a message" << endl; cin >> in; err-> if in == 1 { cout << "Hello, World!" << endl; } else{ cout << "Error, wrong choice" << endl; } return 0; } {- Haskell Code -} main = do putStrLn "Please enter 1 for a message" num <- getLine if num == "1" then do putStrLn "Hello, World" err-> putStrLn "Error, wrong choice"

Alright, so the first notable difference is that the Haskell code is much shorter. It takes up roughly half the space that the C++ code does, yet they both output hello world when the correct number is entered.


Haskell already seems better, right?


Notice how I messed up the if statement in both programs. In the C++ version, I forgot the parentheses, and in the Haskell version I forgot the else. Both omissions are simple mistakes that I’ve made while learning these languages.

Now let’s see the error messages:

-- C++ Error -- main.cpp: In function 'int main()': main.cpp:15:5: error: expected '(' before 'in' main.cpp:19:2: error: 'else' without a previous 'if' Compilation failed. -- Haskell Error -- [..]main.hs:19:1: parse error (possibly incorrect indentation or mismatched brackets) Failed, modules loaded: none.

Both error messages let the programmer know where the mistake happened, but the g++ message is far more helpful. It tells us how to fix the syntax error by adding some missing parentheses. Bam! Problem solved.

Now let us turn to ghc’s output. Okay, something about a parse error… might have indentation errors… and no modules loaded. Cool. Now I’ve never taken a compiler course, so I don’t know what parse error means, and I have no idea how to fix it. The error message is simply not helpful.

Example 2

Here’s another example of parsing errors.

/* C++ Code */ #include <iostream> using namespace std; int main() { err-> string in = "" cout << "Please enter a single word and get the string size back" << endl; cin >> in; cout << "The size of your word, \"" << in << "\", is " << in.length() << "!" << endl; return 0; } {- Haskell Code -} err-> main = {-do-} putStrLn "Please enter a single word and get the string size back" num <- getLine let size = length num putStrLn $ "The size of your word, \"" ++ num ++ "\", is " ++ show size ++ "!"

As you can see, in the C++ I forgot to include a semicolon and in the Haskell I forgot the do in main. As a beginner, I’ve personally made both of these mistakes.

Here are the error messages:

-- C++ Error -- main.cpp:8:2: error: expected ',' or ';' before 'cout' Compilation failed. -- Haskell Error -- [..]main.hs:4:13: parse error on input '<-' Failed, modules loaded: none.

C++ delivers a clear message explaining how to fix the error. Haskell, however, is not so helpful. It says there’s a parse error on the input operator. How should I know this is related to a missing do?

Example 3

Next let’s see what happens when you call the built-in strlen and length functions with no arguments at all.

/* C++ Code */ #include <iostream> #include <cstring> using namespace std; int main (){ char input[256]; cout << "Please enter a word" << endl; cin >> input; err-> cout << "The size of your string is: " << (unsigned)strlen(); cout << "!" << endl; return 0; } {- Haskell Code -} main = do putStrLn "Please enter a word" num <- getLine err-> let size = length putStrLn $ "The size of your string is: " ++ show size ++ "!"

Now let us see the different error messages that are produced:

-- C++ Error -- main.cpp: In function 'int main()': main.cpp:11:61: error: too few arguments to function 'size_t_strlen(const char*)' Compilation failed. -- Haskell Error -- [..]main.hs:7:36: No instance for (Show ([a0]->Int)) arising from a use of 'show' Possile fix: add an instance declaration for (Show ([a0]->Int)) In the first argument of '(++)', namely 'show size' In the second argument of '(++)', namely 'show size ++ "!"' In the second argument of '(++)', namely '"\", is " ++ show size ++ "!"' Failed, modules loaded:none.

Once again, it appears that the C++ compiler g++ knew exactly what was wrong with the code and how to fix the error. It tells me that there are not enough arguments in my function call.

Wow, Hakell’s error message is quite the mouthful this time. I suppose this is better than just a parse error message, but I’m not sure what exactly ghc is even wanting me to correct. The error is simply too technical to help me.

Example 4

Next, we will look at what happens when you pass too many arguments to functions in both languages:

/* C++ Code */ #include <iostream> using namespace std; int main () { string in[256]; cout << "Please enter a single word to get the string size back" << endl; cin >> in; err-> cout << "The size of your string, \"" << in << "\", is " << (unsigned)strlen(in, in); cout << "!" << endl; return 0; } {- Haskell Code -} main = do putStrLn "Please enter a single word to get the string size back" num <- getLine err-> let size = length num num putStrLn $ "The size of your string, \"" ++ num ++ "\", is " ++ show size ++ "!"

And the errors:

-- C++ Error -- main.cpp:16:78: error: too many arguments to function 'int newLength(std::string)' main.cpp:6:5: note: declared here Compilation failed. -- Haskell Error -- Couldn't match expected type 'String -> t0' with actual type 'Int' The function 'length' is applied to two arguments, but its type '[Char] -> Int' has only one In the expression: length num num In an equation for 'size':size = length num num Failed, modules loaded: none.

The C++ error clearly explains how to fix the code, and I even understand the Haskell error this time. Both languages tell me that there are too many arguments. Yet the C++ error message tells me this without a bunch of technical jargon. So even when Haskell is actually helpful with its error messages, it still manages to hide what it wants the user to do.


To me, Haskell seems like a language only for experienced programmers because the errors are not user-friendly. How can I write code if a few simple mistakes cripple my progress? Haskell’s compiler ghc simply lags behind g++ in terms of useful error messages for beginners.

Mike’s Epilogue

I’ve created a patch for ghc that clarifies the specific error messages that Paul had trouble with (and a few related ones). In particular:

  1. Anytime there is a parse error caused by a malformed if, case, lambda, or (non-monadic) let, ghc will now remind the programmer of the correct syntax. In the first example Paul gives above, we would get the much clearer:

    parse error in if statement: missing required else clause
  2. To help with the second example, anytime ghc encounters a parse error caused by a <- token, it now outputs the hint:

    Perhaps this statement should be within a 'do' block?
  3. The third example Paul points out comes from the type checker, rather than the parser. It’s a little less obvious how to provide good hints here. My idea is based on the fact that it is fairly rare for functions to be instances of type classes. The only example I know of is the Monad instance for (a->).

    Therefore, if the type checker can’t find an instance for a function, the more likely scenario is that the programmer simply did not pass enough parameters to the function. My proposed change is that in this situation, ghc would output the hint:

    maybe you haven't applied enough arguments to a function?

This patch doesn’t completely fix ghc’s problem with poor error messages. For example, it doesn’t address Paul’s last point about type errors being verbose. But hopefully it will make it a little easier for aspiring haskellers who still aren’t familiar with all the syntax rules.

Categories: Offsite Blogs

Neil Mitchell: Towards Shake 1.0

Planet Haskell - Tue, 09/16/2014 - 2:54pm

Summary: I've just released a new version of Shake, with a --demo feature and an underlying continuation monad. I want to release v1.0 in the near future.

I've just released a new version of the Shake build system, version 0.13.3. While the version number is only 0.0.1 higher, the changelog lists a large number of improvements. In particular, two changes are:

  • The Action monad is now based on continuations, which allows Shake to suspend threads without requiring a GHC RTS thread. The result is significantly less memory used on thread stacks. I still find it quite amazing that Haskell has such powerful and robust abstraction mechanisms that a huge change doesn't even break the API.
  • The shake binary now features a --demo mode, invoked by running shake --demo. This mode generates a Shake project, compiles it, and shows off some of the features of Shake. You can the output of --demo here.

Version 1.0

With the two features above, I'm now looking towards Shake version 1.0. I'm not looking to make any significant backwards-incompatible change, or necessarily any code/API changes at all. However, if you have anything you think should be addressed before reaching such a milestone, please comment on the issue tracker or email the mailing list.

Shake website

The one thing I still want to finish before releasing version 1.0 is to have a proper website for Shake. I've registered which will host the content, and have set up GitHub pages to serve it up. I have some rough content in the docs directory and a prototype generator in the website directory - as an example it currently generates something a bit like this for the user manual, but with a table of contents when run through the latest generator. I'd appreciate any help with the content, the generator, or the styling - just email the mailing list.

Categories: Offsite Blogs

Chung-chieh Shan: A challenge for a better community

Planet Haskell - Tue, 09/16/2014 - 10:09am

Did you know that all ACM-sponsored conferences have an anti-harassment policy? I didn’t, until I chaired the Haskell Symposium last year. The concise policy says, among other things, that people shouldn’t use my family constitution to interfere with my professional participation. And the policy has teeth. That’s great.

My not knowing the policy and not seeing it publicized didn’t make me go out of my way to harass anyone. But it did make me less sure and less comfortable that I belonged at ICFP. Briefly, it’s because I didn’t know if it would be common ground at the conference that my actual self was fully human. That’s not something I can take for granted in general society. Also, it’s because I didn’t know whether my fellow conference attendees were aware of the policy. We could all use a reminder, and a public signal that we mean it.

For these reasons, I’m very happy that ICFP will start to publicize ACM’s existing anti-harassment policy and make sure everyone registered knows it. All ACM conferences should do it. That’s why Tim Chevalier, Clement Delafargue, Adam Foltzer, Eric Merritt, and I are doing two things. We ask you to join us:

  1. Donate to the Ada Initiative. Our goal is for the functional programming community to raise $8192 by the end of Friday (Sept 19) UTC. To count toward this goal, please use this link:
  2. Call on the ACM and tell your friends. For example, I tweeted this:
    I donate to @AdaInitiative because I want @TheOfficialACM events to announce their anti-harassment policy #lambda4ada

Thanks for improving our professional homes!

(UPDATE: Wow! We reached our initial goal $4096 in just 5 hours! We increased the goal to $8192, thanks to your generosity. And if we raise $16,384, we will sing “There’s no type class like Show type class” and put a recording on the Internet.)

Categories: Offsite Blogs

Hackage package "synopsis" sections

haskell-cafe - Mon, 09/15/2014 - 6:38pm
Hi there, If any of you have ever used CPAN you may agree with me that the synopsis sections customarily included in each package's POD are generally invaluable for getting a quick overview of how to use the facilities provided by that package. I wonder if we might be able to encourage the Hackage community to do something similar? Perhaps in the cabal description authors could include a synopsis with a few code examples? Obviously, I ought to start the ball rolling but I don't actually have any code published on Hackage. Any thoughts? Richard
Categories: Offsite Discussion

ANN: patch-image

General haskell list - Mon, 09/15/2014 - 6:11pm
Right after the announcement of the latest version of Accelerate I like to announce an application build using that framework: "patch-image" assembles a big image from several overlapping parts. Now, let me extract the beginning of the docs: Compose a collage from overlapping image parts. In contrast to Hugin, this is not intended for creating panoramas from multiple photographies, but instead is specialised to creating highly accurate reconstructions of flat but big image sources, like record covers, posters or newspapers. It solves the problem that your scanner may be too small to capture a certain image as a whole. . This is the workflow: Scan parts of an image that considerably overlap. They must all be approximately oriented correctly. The program uses the overlapping areas for reconstruction of the layout of the parts. If all parts are in the directory < at >part< at > then in the best case you can simply run: .
Categories: Incoming News