News aggregator

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

Representing a 3D scene

Haskell on Reddit - Fri, 07/04/2014 - 7:28pm
Categories: Incoming News

Heterogeneous Set: is unsafeCoerce safe here?

Haskell on Reddit - Fri, 07/04/2014 - 6:22pm

I've implemented a heterogeneous set, and it seems to be working (tested on one example :P), but I'm not sure if I'm doing everything right.

First of all, to allow for comparison between two different types, I've written class Ord1':

infixr 4 ==%, /=%, <%, >%, <=%, >=% class Eq1' t where (==%) :: t a -> t b -> Bool class Eq1' t => Ord1' t where compare1' :: t a -> t b -> Ordering -- (/=%), (<%), (>%), (<=%) and (>=%) -- are implemented in the obvious way

Ord1' is a higher-kinded Ord, which (unlike Ord1 from prelude-extras) allows for comparison between t a and t b, where a and b don't need to be equal. So, t is a container which implements comparison without looking inside of a or b.

The heterogeneous set's type is implemented as an unbalanced binary tree as follows:

data HSet v -- leaf node = HSetEmpty -- internal node, storing a value of type 'v a' -- (uses ExistentialQuantification) | forall a. HSetNode (v a) (HSet v) (HSet v)

Functions operating on HSet require v to be an instance of Ord1'.

Insertion is straightforward:

insert :: Ord1' v => HSet v -> v a -> HSet v insert HSetEmpty e = HSetNode e HSetEmpty HSetEmpty insert (HSetNode se l r) e | e <% se = HSetNode se (insert l e) r | otherwise = HSetNode se l (insert r e)

So is (in-order) traversal (Rank2Types in action):

hmap :: Ord1' v => HSet v -> (forall a. v a -> b) -> [b] hmap HSetEmpty _ = [] -- inefficient, but that's fine hmap (HSetNode se l r) f = hmap l f ++ f se : hmap r f

Deletion, however, is more tricky:

-- deletes one instance, if at least one is present delete :: Ord1' v => HSet v -> v a -> HSet v delete HSetEmpty _ = HSetEmpty delete (HSetNode se l r) e | e <% se = HSetNode se (delete l e) r | e >% se = HSetNode se l (delete r e) | otherwise = case l of HSetEmpty -> r _ -> HSetNode popped remains r where (popped, remains) = popMax l se

We do the standard procedure: when we find a matching element, we have to remove it, but its subtrees l and r have to be preserved. If l subtree is empty, we can just plug the right subtree here, and end the procedure.

However, if the subtrees are not empty, they need to be merged. The easiest way to do this is to remove the rightmost element from l (this is done by the function popMax, removed element is called popped here), and use it as the top element, with remains of l (remains) as its left subtree, and r as the right subtree.

The problem is that we don't know the type of popped. This is where unsafeCoerce comes into play. popMax removes the rightmost element of l, and returns it coerced to v a (the type of e):

popMax :: HSet v -> v a -> (v a, HSet v) popMax HSetEmpty _ = undefined popMax (HSetNode se l HSetEmpty) _ = (unsafeCoerce se :: v a, l) popMax (HSetNode se l r) e = let (popped, remains) = popMax r e in (popped, HSetNode se l remains)

That's it.

Example usage:

data Cmp a = Cmp Int a (a -> Double) instance Eq1' Cmp where Cmp key1 _ _ ==% Cmp key2 _ _ = key1 == key2 instance Ord1' Cmp where compare1' (Cmp key1 _ _) (Cmp key2 _ _) = compare key1 key2 s0 = HSetEmpty s1 = insert s0 (Cmp 7 6.0 (+1.0)) s2 = insert s1 (Cmp 3 3 fromIntegral) s3 = insert s2 (Cmp 1 "1" read) s4 = insert s3 (Cmp 5 () (const 5.0)) s5 = delete s4 (Cmp 3 undefined undefined) -- prints "[1.0,5.0,7.0]" main = print $ hmap s5 $ \(Cmp _ v f) -> f v

All code in one piece.

I've read about unsafeCoerce and lifted types, but I'm still not sure:

  1. Is this use of unsafeCoerce safe for all possible values of v and a?
  2. Can I (should I?) coerce to GHC.Exts.Any instead of v a?
  3. Does ExistentialQualification introduce a hidden "vtable" here? Would GADTs have?

Bonus questions:

  1. If I change the first $ to a . in main, it doesn't compile (both with Rank2Types and RankNTypes). Why?
  2. Is there a better way to implement a heterogeneous set?

I've finally made a reddit account after years of lurking, so I'm sorry for posting such a wall of text without any previous contributions. Thanks for reading.

submitted by willIEverGraduate
[link] [6 comments]
Categories: Incoming News

Signal Processing Library

haskell-cafe - Fri, 07/04/2014 - 6:19pm
Hello: I'm working on my Master's Thesis, and I need a signal processing library that can compute FFTs and autocorrelation on discrete data. Doesn't anyone have experience with such a package in Haskell? I appreciate your time. Sincerely, Jeremy Wright _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion