News aggregator

What's up with Hackage's Haddock again?

Haskell on Reddit - Sun, 11/16/2014 - 5:30pm

It hasn't been generating any documentation for any of my packages for at least three days now. What's going on? When's it gonna be fixed?

submitted by nikita-volkov
[link] [9 comments]
Categories: Incoming News

How do I build a library locally?

Haskell on Reddit - Sun, 11/16/2014 - 4:03pm

I've been working on some Haskell board games as a learning exercise, using Gloss for the interface. The main program is an implementation of HexDame (a hex-grid version of draughts), with some basic game-tree-searching AI. Here's where it's at, if you're curious:

The game tree search is fairly slow. I thought I'd switch to an infinite tree data structure for the game tree, to effectively cache the results of previous frames' searches. Unfortunately this made my program explode with memory usage, which was somewhat surprising.

I read a few days ago that someone discovered a memory leak in Gloss, where it was hanging on to every frame's state. Checking the Gloss Github ( I see that this was fixed in August, but I don't know if the fix is present in the current 1.8.2 version that I installed via Cabal.

I'd like to try out the current head version of Gloss to see if the memory leak I'm experiencing is fixed. I'm working on Windows, and I'm fairly new to working with Cabal. I installed the Haskell Platform 2014.2 and then ran 'cabal install gloss' and that was it.

Can anyone point me to info about how I would go about installing Gloss as a library that I build from source? I've heard about Cabal sandboxing but I'm not sure how one does it.

Thanks, James

submitted by mcneja
[link] [5 comments]
Categories: Incoming News

How to reverse ghc encoding of command line arguments

haskell-cafe - Sun, 11/16/2014 - 3:42pm
I have a question about how to reverse the text encoding as done by ghc and the base library for stuff that comes from the command line or the environment. Assume the user's environment specifies a non-Unicode locale, e.g. some latin encoding. In this case, the String we get from e.g. System.Environment.getArgs does *not* contain the Unicode code points of the characters the user has entered. Instead the input bytes are mapped one-to- one to Char. This has probably been done for compatibility reasons, and I do not want to discuss this choice here. Rather, I want to find out how I can convert such a string back to some proper Unicode representation, for instance in order to store the value in a file with a defined encoding such as utf-8. This should be done in a generic way, i.e. without making ad-hoc assumptions about what the user's encoding might be. There is the iconv package. However, it takes ByteString as input and output and it also requires that I give it the encoding as input. How do I
Categories: Offsite Discussion

Are there ways to relax the typing system for IO?

Haskell on Reddit - Sun, 11/16/2014 - 11:55am

Sorry, I am annoying. Good news, though, this complaint isn't about Cabal, but the language itself. I've noticed (maybe it is just me?) that doing some really simple, almost trivial things become really difficult in Haskell due to the treatment of IO. Monads transformers and such are really laborious to work with for me, which is ironic, because the IO is almost aways the easiest part of the work in other languages, as well as the place where you care less about potential bugs - thus, the least place you need types anyway.

Given that, is there any way to just relax the typing system when I want to do IO? Honestly, I wouldn't mind something as simple as an embedded Scheme interpreter with a lot of IO (file systems, networking, everything goes there), and access to Haskell's pure functions. That way I'd just program stuff in Haskell and use that language as a bridge to the real world.

submitted by SrPeixinho
[link] [13 comments]
Categories: Incoming News

Is Haskell right for me?

Haskell on Reddit - Sat, 11/15/2014 - 6:06pm

Hello ladies and gents,

I am completely new to programming in general and I decided to take a crack at Haskell for my first language. I only got through the first part of "Learn You a Haskell for Great Good!" and I like how intuitive this language is. With that being said, I can see that learning Haskell or any language for the matter takes up a lot of time. No, I'm not going to ask if Haskell is better than C++ or Python. I understand that each language has benefits and drawbacks. Instead, I want to know if it can do what I need more efficiently than other languages.

So here is something I would be interested in: Get a list of all of the equities currently trading in the US. From there find the past 5 years of trailing twelve months ratios like: P/BV, EV/EBITDA, P/EBIT, P/CFO, and P/FCF. Visualize the distributions of the ratios at any given point in time. Pick any security on the list and get a percentile ranking for ratios at any given point in time. For example: Ford is at the 70% cumulative percentile for P/BV at Jan 2014 and 40% cumulative P/CFO at Jan 2014. Visualizing these ratio distributions will give me a better way to compare securities and see how the general market is acting.

The situation described above is just one of the many ways I want to use a programming language for financial applications. Since my winter break is coming up soon I want to devote most of it towards getting good at programming. I'm not afraid of a steep learning curve. I am also not looking to get hired in finance based on my programming abilities (there are none as of now). Instead, I just want to experiment with whatever language I learn to help me with finance or anything else really. So, is Haskell right for me? Is there another language that will help me do what I want more efficiently?

About me: Things I know a little bit about that I will use a language to answer questions in: econometrics, statistics, accounting, finance

submitted by dandraper15
[link] [59 comments]
Categories: Incoming News

Magnus Therning: Regular Haskelling. How?

Planet Haskell - Sat, 11/15/2014 - 6:00pm

Ever since ICFP 2014 I’ve had as a goal to get into the habit of coding in Haskell. It’s been the language I enjoy most for a few years now, but being surrounded by and talking to so many brilliant developers as I did during that week really drove home that I will only have more fun the more code I write. My goal was not very ambitious; just write something in Haskell most days every week. So far I’ve managed to keep it up.

These are a few tricks I’ve used and they’ve worked well for me so far.

Just write, no matter what, just write

In ninth grade a rather successful Swedish author visited my school and what I remember most from that is one thing he said:

Just read! It doesn’t matter what. It doesn’t matter if what you read isn’t considered good literature; read Harlequin books if that’s what you like, read magazines, read comics. Just read!

I think the same holds for writing code; it’s only with practice that one gets comfortable expressing oneself in a particular language.

Fix warts

I can’t actually think of any piece of code I’ve written that doesn’t have some warts. It may be in the form of missing features, or quirks (bugs) in the implementation that forces the user to regularly work in a less-than-optimal way. I’ve found fixing warts in tools and libraries I use myself to be one of the most rewarding tasks to take on; the feedback is so immediate that every fix cause a boost in motivation to fix the next one.

Exercise sites

Sometimes it’s simply difficult to find the motivation to tackle working on an existing project, and inspiration for starting something new might be lacking too. This happens to me regularly, and I used to simply close the lid on the computer earlier, but now I try to find some exercises to do instead.

There are several sources of exercises. I know Project Euler is rather popular among new Haskellers, but there are others.

  • CodeEval is a site with problems in three different levels. It may be extra interesting for people in the US since some of the problems are sponsored by companies which seem to use the site as a place for recruiting. So far I’ve only seen American companies do that, but I suppose it might catch on in other parts of the world too. Haskell is one of several languages supported.
  • Exercism is both a site and a tool. The goal is to facilitate learning of languages. On first use the tool will download the first exercise, and after completion one uses it to upload the solution to the site. Once uploaded the solution is visible to other users, and they are allowed to “nitpick” (comment). After uploading a solution to one exercise the next exercise in the series becomes available. It supports a rather long list programming languages.

I like both of these, but I’ve spent more time on the latter one. Personally I find the idea behind Exercism very appealing and I’ve been recommending it to a couple of co-workers already.

Feel free to put links to other sources of exercises in the comments.

Simplify old code

With more practice comes more and more insights into what functions are available and how to string them together. When I don’t even feel like doing a full exercise on Exercism I just dig out something that smells a little and clean it up. Anything is fair game, no matter how tiny. Just take a look at my implementation of reThrowError.

What else?

I’d love to hear tips and tricks from other people who aren’t lucky enough to have a day job where they get to write Haskell. How do you keep up the learning and practice?

Categories: Offsite Blogs