News aggregator

Control.Exception.bracket is broken(?)

haskell-cafe - Sun, 07/06/2014 - 2:15pm
Hello, From docs: "If an exception is raised, then bracket will re-raise the exception (after performing the release)." But what if the release action will throw an exception? There are 3 options: 1) suppress the exception from release action and rethrow the original one 2) shutdown the program 3) suppress the original exception and throw the exception from release action. Current behavior is #3 -- suppress the original exception. I think it the worse choice. What other languages do: - java has try-with-resources statement which is the nearest equivalent of haskell's "bracket". It uses the option #1 (rethrow the original exception) - in c++ it is common to use RAII for resource management, so someone's destructor performs resource cleanup. But if destructor throws exception during stack unrolling, the program is terminated (option #2) I prefer #2 because suppressing exception is a really bad idea. What is your choice? And the related thing. Release action should not use any interruptible action.
Categories: Offsite Discussion

Newbie trying to install yesod

Haskell on Reddit - Sun, 07/06/2014 - 7:12am

Hi /r/haskell,

I'm very new to Haskell. I don't know if this is the right place to ask questions so bear with me. I'd like to install yesod (Ubuntu 12.04-64) via

cabal install yesod-platform yesod-bin --max-backjumps=-1 --reorder-goals (straight from yesod website)

Whenever I run this command, I get the following message:

Resolving dependencies... Killed

and yesod doesn't get installed. What's happening? How can I solve this?

BTW, is yesod a good framework? What do you guys mostly prefer; snap or yesod or something else?


submitted by threading
[link] [4 comments]
Categories: Incoming News

Most powerful high(est) level programming language?

Haskell on Reddit - Sun, 07/06/2014 - 3:39am

Here is an interesting article from 2001 on the 'power' of Lisp:

And a nice comparison article from 2009 on the 'power' of Haskell:

They are interesting to read as if written by the same programmer on a 20 year quest to find 'powerful' language(s).

It got me thinking about the breakdown of 'relative power' of the highest level languages in terms of criteria scored in these articles, like expressiveness, efficiency of code, ability to (easily) solve notoriously difficult or complex problems, etc. Is it fair to rank Haskell as the 'highest level power language' for 'high level' tasks, given that not all high level languages are equally powerful? Sorry for the vague circular logic here, but I'm just attempting to pass along the opinions of these articles with minimal interpretation.

I know that the answer depends on what you plan to do with the language. Let me remain vague by saying a general purpose language for 'very high level' tasks given modern environment and lessons learned.

submitted by RaymondWies
[link] [28 comments]
Categories: Incoming News

Signal Processing Library

haskell-cafe - Sat, 07/05/2014 - 11:03pm
Hi, There is also a signal processing package on Hackage [1] which performs auto_correlation. FFT is has been moved from hmatrix to hmatrix-gsl [2]. Hope this helps. Cheers, Vivian [1] <> [2] <> Date: Fri, 4 Jul 2014 10:19:51 -0700 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

ghc, tls, gmp

glasgow-user - Sat, 07/05/2014 - 10:04pm
Hi, in Debian, we have the (well-known) problem of linking against libraries using libgmp, in this case haskell-curl, which links against libcurl, which links against gnutls, which uses libgmp since the latest release: Are there any viable solutions to this problem that I might not be aware of? Are there any solutions to be expected in the near future? (My best idea so far is to use libcurl linked against openssl, but this causes licensing issues.) Greetings, Joachim
Categories: Offsite Discussion

Checking minimum package bounds

haskell-cafe - Sat, 07/05/2014 - 8:37pm
Often a topic of discussion is making sure that the upper bounds on one's packages are up to date, or even whether upper bounds are a good idea at all. I don't see much discussion on lower bounds. Lower bounds that are needlessly restrictive can get in the way too. For instance, I could just slap "text >= 1.1 && < 1.2" on my package, but this makes things needlessly hard for someone trying to make my package work in conjunction with an older one, especially if all I use are basic functions like "pack" that have been around at least since, say. text-0.11. Does anyone have a best practice for testing and verifying lower bounds? Testing the lower bounds and the upper ones is a challenge. Does anybody bother? I have my sunlight package at but it is really a nasty hack. I am considering cleaning it up so it is less of a nasty hack but before I do that I wondered if anyone else has ever thought about this problem. Thanks. Omari ___________________________________
Categories: Offsite Discussion

On smart code-completion in Haskell, idris-mode style. (Advice needed)

Haskell on Reddit - Sat, 07/05/2014 - 6:43pm

tl;dr I'd like to hear your opinion about smart code completion in haskell, in the spirit of agda-mode or idris-mode, and propose two possible way to limit the information loss caused by having a weaker type-system.

I really like the completion mechanism for code in languages with full dependent types like Idris or Agda. I'd like similar (or better) code completion facilities for Haskell.

To see how this could be done, let's start with a idris example:

filter : (a -> Bool) -> List a -> List a filter f [] = [] filter f (x::xs) = ?what

Now, a type-correct (and minimal, in the sense of proof search) completion of ?what is xs, and is in fact the answer of idris-mode. This is of course not ok, so let's say you want a precise enough type to be able to generate the function automatically. You could encode additional invariants in your function, beginning with:

filter : {a : Type} -> {P : a -> Type} -> (decideP : (x : a) -> Dec (P x)) -> List a -> List (x : a ** P x)

or the code in this paste. (thanks to ziman and {AS} for the conversation in #idris and the examples). At the end of the spectrum, you could encode all your invariants in the type.

On the flip side, I don't see a general, easy way to balance specification vs. code, and I fear the proliferation of many functions essesntially on the same object but with different specifications. Moreover, I'd like to take advantage of the rich ecosystem and the wonderful compiler we have in haskell.

So, how could we alleviate the loss of dependent types? The answer I'm thinking of is a mixture of heuristics and code generation via examples.

Heuristics: One could argue that in the second definition of filter, the answer

filter f (x::xs) = xs

fails to recognise the role f and x could have in the equation. In a sense, this expression scores low on the heuristic "argument usage". Another heuristics may me the number of function applications in your code (lower is better), which could rule out the obvious pitfalls of a naive theorem prover (solutions like x : [], x : x : [], x : x : x : [] etc). One could also guide the program towards the intended implementation writing "hints", functions that we imagine would be used in the final implementation (heuristic: hint-usage).

Other heuristics could be found among the standard ones used in automated theorem proving. The point here is that it seems to me that there are sufficient good heuristics avaiable to guide the writing of our code.

Code generation via examples: The second point I'd like to make is related to interface: even using all heuristics we are able to come up with, the answer could still typecheck without being what we had in mind:

if f x then xs else x : xs if f x then xs else [x]

So here the program could take simple arguments (or even generate them via quickCheck), like odd :: Integral a => a -> Bool, and [1,2,3,4,5], and output various possible answers for filter odd [1,2,3,4,5], based on the different implementations it can come up with. Hopefully choosing the expected answer could guide the program towards a unique correct implementation.

On a final note, I have "tested" this approach with some (simple, but not too simple) programs (imagining the heuristics that would be used, and the examples that would guide the generation). The results seemed nice to me, and having those automated would be a great speedup for my coding.

So, I'd like to hear your thoughts here, expecially on:

  • What flaws/problems/shortcomings may this approach have, in your opinion? Please provide some example.

  • Could you name programs/tools that I should probably use in this project, and why?

  • Do you know some papers/theory I should definitely read to refine my approach?

  • If you're a person interested in giving occasional hints and guidance on the overall architecture, be sure to write it below.

  • Extra advices are always appreciated, even if they don't belong to previous categories.

submitted by meditans
[link] [9 comments]
Categories: Incoming News

withFile variant which takes a ByteString?

haskell-cafe - Sat, 07/05/2014 - 4:52pm
Hi all, Is there a variant of withFile which takes a ByteString? (I'm aware that I could use the lower-level System.Posix FD-based functions, but if someone already has a package out there, I'd rather not.) Regards,
Categories: Offsite Discussion

Looking for a Haskell teacher in the NYC area

Haskell on Reddit - Sat, 07/05/2014 - 4:05pm

I'd like to find a tutor to help me get up to speed in Haskell. Willing to pay for a few lessons. If you can help, please PM me. If you know of other places where I should ask this question, that would also be appreciated.

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

Is there a relation between the operational monad and the free monad?

Haskell on Reddit - Sat, 07/05/2014 - 1:10pm

Some time ago I learned about the operational semantics for monads in a blog post by /u/apfelmus. It seemed like a nice way to build a monadic DSL.

More recently I saw lots of internet discussion about the Free Monad, which is also a pattern that can be used to create monadic DSLs.

Is there a deeper algebraic relationship between those two patterns?

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

Lambdaheads: functional programming group in Vienna

Haskell on Reddit - Sat, 07/05/2014 - 8:23am

Dear Friends of functional Programming!

The next meeting of the Lambdaheads( will take place on Wed. July 9th 19:30 in the Metalab( library, everyone interested in programming languages especially functional ones is welcome to join.

Topic of the meeting will be "monads", a topic most often misunderstood and declared too abstract for the common programmer. I will try to present on this topic in a comprehensible way and want to explain why any programming language profits in having monads, be it only to get rid of the nullpointer-problem.

Looking forward to meeting all of you cheers Martin

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

Why does this leak memory?

Haskell on Reddit - Sat, 07/05/2014 - 3:53am
import Control.Monad main = forM (map show [0..(2^64)]) putStrLn

Why does this leak memory like a sieve? Why is [x..y] not the equivalent of python 3's range function or more accurately, not the equivalent of a python generator?

Isn't the point of lazy evaluation in haskell not allocating gobs of memory for things we don't need until we need them and then throwing them away when they are no longer needed? I've only just started haskell and haven't got into monads yet (I've got a rough idea of what they are about) but having such a simple program leak memory made me question my sanity.

submitted by dardyfella
[link] [9 comments]
Categories: Incoming News

Emacs haskell-mode : how to send PART of file to repl ?

Haskell on Reddit - Sat, 07/05/2014 - 3:19am

In many emacs language modes, there are commands for interacting with a repl/interpreter for that language.

Often there are commands for sending just specific parts of the file (like single expressions or subexpressions or regoins) to the repl.

For example (among, no doubt, numerous others)

  • In ocaml, with tuareg C-c C-e (tuareg-eval-phrase)

  • In clojure, with cider (M-x cider-jack-in) C-c C-e (cider-eval-last-sexp)

  • In ruby, with ruby-mode C-x C-e (ruby-send-last-sexp)

I'm trying to do this in haskell-mode. I can type stuff in the repl within emacs and it seems to work. And while editing a buffer containing a .hs file, I can load the WHOLE file into the repl with:

C-c C-l (haskell-process-load-file)

BUT I'm not sure how to send to the repl:

1) only a portion of the file

2) "naked expressions" I tried a file with just a single expression and it gave an error. This is no big deal if you have to evaluate the whole file anyway. But if a "portion" were possible (point 1) then being able to send an expression or subexpression to the repl is sometimes useful.

I'm just having a little look at haskell, and am just trying to get a nice interactive setup.

Any suggestions on how to send portions of a haskell file to the repl would be much appreciated.

I'm hoping there's just some configuration technique that I'm not aware of.

I guess it might be possible to write an emacs mode or modify haskell-mode to do this. But as just a basic emacs user, that's probably not a good option. And also, if it is not possible in the existing haskell-mode (written by someone who knows a lot more haskell and emacs than I do) then maybe there's some technical difficulty with doing it. (Considering it's a fairly obvious thing to do and is done for many other languages)

Note: Previously asked on r/haskellquestions.
But no response. So asking again here where the traffic is greater by an order of magnitude or two.
(And people seem to be asking quite a few questions anyway.)

submitted by tersoffe
[link] [4 comments]
Categories: Incoming News

How do you work around the lack of "cabal upgrade"?

Haskell on Reddit - Sat, 07/05/2014 - 2:47am

How do you keep your globally installed Haskell tools (e.g. pandoc, hlint, etc.) up to date?

The whole situation currently seems pretty messy to me. With cabal sandboxes, the user package database seems really redundant to me. All I still install to it are Haskell tools like pandoc, where I am not interested in the modules and packages, but only in the frontend programs, and I'd like to keep these up to date, like any other program I use.

Currently, I'm keeping a list of programs I use, and do cabal install --upgrade-dependencies foo for each of them occasionally, which is pretty tedious, and occasionally fails due to version conflicts.

Ideally, I'd build each program in a separate sandbox, and only install the statically linked binaries and data files (as in cabal copy). Is there any tool for this?

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

CFP: PRDC2014 Call for Fast Abstracts / Industry Track Papers / Posters

General haskell list - Sat, 07/05/2014 - 2:44am
PRDC2014 Call for Fast Abstracts / Industry Track Papers / Posters Singapore Nov.18-21,2014 --------------------------------- Call for Fast Abstracts --------------------------------- Fast Abstracts at PRDC are short oral presentations, either on new ideas or work in progress, or opinion pieces that can address any issue relevant to dependable systems and networks. Because they are brief and have a later deadline, Fast Abstracts enable their authors to: .Summarise work that is not yet complete .Put forward novel or challenging ideas .State positions on controversial issues .Suggest new approaches to the solution of open problems Thus, they provide an excellent opportunity to introduce new work, or present radical opinions, and receive early feedback from the community. Contributions are particularly solicited from industrial practitioners and academics that may not have been able to prepare full papers du
Categories: Incoming News

async simplify code

haskell-cafe - Sat, 07/05/2014 - 1:58am
Hi Cafe, Is there any way to simplify this async code to somehow merge the withAsync code into the STM code? Looking at the code for tstABorCD it is not easy to see that it is really just (A&&B)||(C&&D). Here is the code: Thanks for any pointers, Grant _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

How to state semantics in denotational design?

haskell-cafe - Sat, 07/05/2014 - 12:49am
Dear all, This may seem a strange question due to my unfamiliarity with formal semantics, but bear with me. I am trying to apply denotational design principles to my library music-score, and often find myself writing down semantics of data structures in pseudo-Haskell such as The actual implementation of the data structures may or may not be identical to the semantics. For example, it makes sense to implement Span as (Time^2) or (Time x Duration), as these types are isomorphic. My question is basically: 1) Is my approach (using pseudo-Haskell) a sound way to state denotational semantics? 2) How can I state semantics (in code and/or documentation), and be sure that my implementation follow the semantics? I understand that the correctness of the implementation w.r.t. to the semantics can be verified using manual proofs, which worries me as I want to be able to refactor the semantics and be make sure that the implementation is still correct without having to repeat all the proofs. Is there a "trick" to e
Categories: Offsite Discussion

GHC and Haskell-Platform on OpenBSD

glasgow-user - Fri, 07/04/2014 - 10:50pm
Hi, I'd like to know wether anyone here is using GHC on OpenBSD *and* relying on the Haskell-Platform meta package for OpenBSD. If there's no need for the HP meta package, I could just start to update GHC and all related packages for OpenBSD, but if there are a lot of people who prefer to stick to the HP, I'd to wait until the official update of the HP. So, if you love running pkg_add haskell-platform on OpenBSD, please speak up. And if you don't care an just run pkg_add ghc please speak up too ;-) Ciao, Kili
Categories: Offsite Discussion