News aggregator

GSoC Retrospective

haskell-cafe - Thu, 09/17/2015 - 9:13am
In past years, Gwern did an outstanding job of summarising the GSoC proposals and how well they had done: <> Here are the proposals for this year. Perhaps students or their mentors could comment on how successful their projects have been? I realise this is a very poor substitute for Gwen’s analyses but it would better than nothing. A Strict language pragma for GHC - Adam Sandberg Eriksson <> STM Data Structures Implementation <> - Alex Semin Implementation of Layered Gramamar of Graphics <> - chinu <> Implementing Version Comparison for Cabal Packages - Craig Roche <> Improving Hackage Discoverability <> - D. Zack Garza <> Darcsden improvements <htt
Categories: Offsite Discussion

Proper way for library writers to handle errors

Haskell on Reddit - Thu, 09/17/2015 - 8:30am

In writing library functions, what is the best way these days to let users handle errors how they want to? In times past you could simply use the much hated (for good reason) fail function and then the user could simply instantiate with the monad they wanted for the kind of error handling they required (e.g. if they didn't need to know why something failed they could use Maybe, they could use Either if they wanted the message or even IO if they wanted a crash).

But since the fail definition has been removed from the Either monad definition, this strategy doesn't work anymore. What is the correct way to do this now? Everything I've read seems to explain how to explicitly use different kinds of errors (e.g. EitherT, MaybeT and so on) but that's exactly what I don't want to do.

submitted by haskellUser
[link] [20 comments]
Categories: Incoming News

Discussion thread about stack

Haskell on Reddit - Thu, 09/17/2015 - 8:00am

I'm sure I'm not the only person who's noticed that discussions about the stack build tool seem to have permeated just about any discussion on this subreddit with even a tangential relation to package management or tooling. Personally, I love stack, and am happy to discuss it with others quite a bit.

That said, I think it's quite unhealthy for our community for many important topics to end up getting dwarfed in rehash of the same stack discussion/debate/flame war that we've seen so many times. The most recent example was stealing the focus from Duncan's important cabal talk, for a discussion that really is completely unrelated to what he was saying.

Here's my proposal: let's get it all out in this thread. If people bring up the stack topic in an unrelated context elsewhere, let's point them back to this thread. If we need to start a new thread in a few months (or even a few weeks) to "restart" the discussion, so be it.

And if we can try to avoid ad hominems and sensationalism in this thread, all the better.

Finally, just to clarify my point here: I'm not trying to stop new threads from appearing that mention stack directly (e.g., ghc-mod adding stack support). What I'm asking is that:

  1. Threads that really aren't about stack don't bring up "the stack debate"
  2. Threads that are about stack try to discuss new things, not discuss the exact same thing all over again (no point polluting that ghc-mod thread with a stack vs cabal debate, it's been done already)
submitted by snoyberg
[link] [281 comments]
Categories: Incoming News

[Haskell-cafe] GSoC Retrospective; tell r/haskell about your experience and projects

Haskell on Reddit - Thu, 09/17/2015 - 6:31am

There was recently a post, [Haskell-cafe] GSoC Retrospective; so I ask, "GSoC participants, how was your experience and what would you like to tell us about your results?"

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

good book to learn Haskell

Haskell on Reddit - Thu, 09/17/2015 - 5:50am


Because of the reccomendations of bitemyapp github page I tried to learn haskell by the Craft book.

The explanation was fine the only thing that makes my grazy was that a lot of exercises were written on a way that was not clear what was the meaning of the exercise.

Now I wonder.

Is there a book with a lot of exercises where I can learn Haskell.

I have looked at LYAH but there no exercises.


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

Looking for better than Dragon Book

haskell-cafe - Thu, 09/17/2015 - 12:39am
I've got the Tiger Book, ML version, which I will use to help me implement Tiger in Haskell. Below is a class curriculum I've found. But besides the Tiger Book, it uses the Dragon Book. I know there are more modern books out there. Looking for suggestions as what might be a good fit. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Ancient use of generators

Lambda the Ultimate - Wed, 09/16/2015 - 11:58pm

Guido van Rossum reminisces a bit about early discussions of generators in the Python community (read the other messages in the thread as well). I think we talked about the articles he mentions way back when. Earlier still, and beyond the discussion by Guido here, was Icon, a clever little language that I have a soft spot for. i don't think we ever fully assessed its influence on Python and other languages.

Categories: Offsite Discussion

Portable Efficient Assembly Code-generation in High-level Python

Lambda the Ultimate - Wed, 09/16/2015 - 6:53pm

PeachPy is a Python framework for writing high-performance assembly kernels.

PeachPy aims to simplify writing optimized assembly kernels while preserving all optimization opportunities of traditional assembly.

You can use the same code to generate assembly for Windows, Unix, and Golang assembly. The library handles the various ABIs automatically. I haven't seen this cool project before.

Among the cool features is the ability to invoke the generated assembly as regular Python functions. Nice.

Categories: Offsite Discussion

Is there a portable way to get file size?

Haskell on Reddit - Wed, 09/16/2015 - 6:05pm

Stack Overflow suggests to use System.Posix but after asking around it seems that Windows dropped support for that with 8.1.

I am imagining that the change happened in Windows 8.1 and a solved problem became unsolved, so how do I do this today? It seems like a relatively fundamental thing, so maybe it would make sense to have this kind of thing in the already portable System.Directory library which currently has things like getModificationTime anyway?

edit: looks like System.IO.hFileSize is what I was looking for. Seems obvious now :P And it appears to be O(1) and all, so hopefully next time I know where to look now :)

submitted by wheatBread
[link] [10 comments]
Categories: Incoming News

Simple question about blackholing

haskell-cafe - Wed, 09/16/2015 - 4:57pm
Hello, By all accounts I've found a thunk is blackholed by replacing its header with a (the) blackhole code pointer (or blackhole info pointer in the unregisterized case). My simple-minded question is how garbage collection can take place given that the layout of the payload is lost. Surely not a custom blackhole for each (statically defined) thunk? A list of blackholes maintained somewhere that the GC knows about? Thanks for any insight! Kei
Categories: Offsite Discussion

Trouble with "where" block during compilation

Haskell on Reddit - Wed, 09/16/2015 - 4:31pm

Recently I've been having some fun working through "Learn You a Haskell" and until now, every piece of code in the book has compiled without issue. But now, I've entered this code from the book:

initials :: String -> String -> String initials firstName lastName = [f] ++ ". " ++ [l] ++ "." where (f:_) = firstName (l:_) = lastName

and I get this error: "124:25: parse error on input ‘=’" (the line where the error is thrown is the last line of the code under the "where" block, "(l:_) = lastName." My syntax is exactly as in the book. What could be the problem here?

submitted by AlanMGodel
[link] [8 comments]
Categories: Incoming News

LVars & producer/consumer pattern

Haskell on Reddit - Wed, 09/16/2015 - 11:51am

I read part of this paper about LVars.

I don't understand the implementation on page 9. The code is supposed to call analyze on the elements added to analyzedSet as soon as they are added. Unfortunately, the machinery of how analyze is applied to the elements is hidden.

What I don't understand is what the threshold for the get is supposed to be to read the first element of the result.

In general, let's say N threads add elements to a set. The updates are monotonic, but how can I get the elements as they arrive? This would be non-deterministic by definition. That's the point of the producer/consumer pattern.

I'm missing something here...

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

Noob question involving data constructors

Haskell on Reddit - Wed, 09/16/2015 - 11:40am

How would I use an if statement to check if the given input (information) is in my Player data constructor? Such as...

data Player = playerA | playerB | playerC data playerInfo = playerInfo Player Int Int information = playerInfo playerA 10 10 newteam :: playerInfo -> Maybe playerInfo newteam (Info p x y) = if (check if p is in Player data constructor) then Just (playerInfo p x y) else Nothing submitted by kendrickisgoat
[link] [4 comments]
Categories: Incoming News

how to find the middle number at all cases

Haskell on Reddit - Wed, 09/16/2015 - 8:06am


I have this code :

middleNumber :: Integer -> Integer -> Integer -> Integer middleNumber x y z | between y x z = x | between x y z = y | between z y x = y | otherwise = z between :: Integer -> Integer -> Integer -> Bool between a b c = a <= b && b <= c

on middleNumber 1 2 3 it works fine. But on middlenumber 2 1 3 or 3 1 2 it fails.

How can I make this work. Add quards to between or is there a better way ?

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

Mark Jason Dominus: A message to the aliens, part 10/23 (temperature)

Planet Haskell - Wed, 09/16/2015 - 8:06am

Earlier articles: Introduction Common features Page 1 (numerals) Page 2 (arithmetic) Page 3 (exponents) Page 4 (algebra) Page 5 (geometry) Page 6 (chemistry) Page 7 (mass) Page 8 (time and space) Page 9 (physical units)

This is page 10 of the Cosmic Call message. An explanation follows.

The 10 digits are:


The top half of this page is a table of melting points (on the left) and boiling points (on the right) for various substances: hydrogen , carbon , sulfur , zinc , silver , and gold . The temperatures are given in kelvins .

The boiling points depend on pressure, so there is a notation at the bottom of the list that the pressure should be 101300 pascals . This is one standard atmosphere, so it may tell the aliens a little more about our planet.

To help calibrate the kelvins, the bottom of the page is a chart of the temperature increase of water , showing how the temperature stops increasing at the melting point (273K) and the boiling point (373K). This introduces the glyph for temperature , which will recur later.

There are two regrettable things about this chart. One is that the horizontal axis is labeled “time” . Why is the temperature of the water increasing with time? It should be energy.

But a more serious complaint, I think, it that this is the wrong chart. It depends crucially on the (Earth-)standard atmospheric pressure, with which the recipients may not be familiar. And the kelvin is not defined in terms of standard pressure anyway. It is defined in terms of the triple point of water, the unique, universal temperature and pressure at which all three states of water can coexist. Why not a temperature and pressure chart with the triple point labeled? This is something one might more reasonably expect the aliens to have studied.

The next article will discuss page 11, shown at right. (Click to enlarge.) Try to figure it out before then.

Categories: Offsite Blogs