News aggregator

Concept for "equal but unknown"

haskell-cafe - Fri, 10/02/2015 - 8:23am
Hello all, there is a problem which popped up a number of times recently and I wondered if there is a general concept to tackle this kind of problems. It goes like this: I book a hotel room. At this time it becomes known that the hotel has one fewer room available, but it is not known which room it is. Likewise I know, that I have a reservation for "a room", but I don't know which one it is. It is however known, that the room in my reservation is the same room the hotel has removed from the list of available rooms. Another example: In air-cargo the cargo company has reserverd space in an aircraft for two containers. One for high-priority parcels and one for low-priority parcels. In the cargo hub, they plan to pack these two containers. At this point in time it is only known that there will be two containers one labelled "high-prio" and the other labelled "low-prio" but their physical identity is not known. Only when you actually do the packing you have a physical container at hand, which has identity. At
Categories: Offsite Discussion

ghc-mod for tooling

Haskell on Reddit - Fri, 10/02/2015 - 6:56am
Categories: Incoming News

using nmitchell's space leak detection technique

glasgow-user - Fri, 10/02/2015 - 3:02am
Neil Mitchell wrote an article about finding space leaks by limiting the stack size: I'm giving it a try, but the results don't make any sense to me. My understanding is that the too-deep stack indicates that someone created too many thunks, so when they get evaluated you have to descend too many times. And if the stack trace seems to be a reasonable size (say 100 stack frames somehow consuming 1mb of stack) then it means there is a recursive call in there somewhere that ghc is helpfully eliding. And lastly, that the thing about "Stack space overflow: current size 33568 bytes." always showing 33568 bytes is due to a ghc bug and it should actually be whatever limit I gave it. Is all this accurate? The stack trace jumps around a lot, to places which are not lexically present in the caller. I assume this is just lazy evaluation, so e.g. maybe 'f' doesn't call 'g', but if 'f' forces a value returned from 'g' which has not yet been forced,
Categories: Offsite Discussion

Haskell book recommendations list

Haskell on Reddit - Fri, 10/02/2015 - 2:34am

instance KindOfSpam? MyPost where ... Hi folks, ok this is spammy but I wanted to plug my site for book recommendations. VivalaBooks - thread on HN

Honestly my original intention was to write my app in Haskell but my Haskell expertise just isn't there yet. There seems to be a big cognitive jump for me between LYAH and the Yesod book. And I still plan to convert it to Haskell slowly piece by piece as my skills grow. But Im hoping you guys can add some bits of wisdom to my Haskell book recommendations list:

Learning Haskell

submitted by marai2v
[link] [15 comments]
Categories: Incoming News

FP Complete: Retiring FP Haskell Center

Planet Haskell - Fri, 10/02/2015 - 12:00am

Back in April, I announced plans for the future of School of Haskell and FP Haskell Center. We're now half a year later, and it's time to start moving ahead with those plans. The summary is:

  • FP Haskell Center will be retired by the end of the year, please migrate your projects now.
  • School of Haskell will be transitioned to its own domain name,, with hopefully no interruption in service.
Migrating projects from FP Haskell Center

In order to migrate your projects, please:

  1. Open your project on
  2. Select the Git menu from the top bar
  3. To get a tarball with all of your sources, choose "Source dist"
  4. To retain your full project history, push to an external Git repository (such as on Github or Bitbucket)

As readers of this blog are likely familiar already, FP Complete and the Commercial Haskell group have been putting a lot of effort into the Stack build tool for easily and reliably building Haskell code. We recommend migrating your project to Stack.

School of Haskell

We have three milestones along the path to our new, open sourced School of Haskell:

  1. Release ide-backend - the core engine powering School of Haskell - as open source. We completed this process in March, and ide-backend has continued as a successful open source project since then.
  2. Create a School of Haskell API service, allowing arbitrary websites to "activate" Haskell code on their sites to create interactive snippets for their users. The open source schoolofhaskell repository is mostly feature-complete, and we are currently making refinements before launching the service.
  3. Extract the School of Haskell HTML display and edit code to its own project and host on At that point, users will be able to view and edit their content on instead.

Once all three steps are complete, we will begin redirecting users from to


We expect the School of Haskell changes to be completed by the end of October. We will be sharing more information about this process as it unfolds, and once the new deployment is available, will welcome contributions to improve the School of Haskell. We also look forward to seeing how others are able to take advantage of the new service API to extend their own websites.

For FP Haskell Center: we will be shutting down the service completely at the end of 2015. We will soon deploy changes to provide a warning when accessing FP Haskell Center about the impending shutdown. Once the service is shut down, your data will be inaccessible. Please ensure that you have backed up any data and code you wish to retain.

Categories: Offsite Blogs

Douglas M. Auclair (geophf): September 2015 1HaskellADay Problems and Solutions

Planet Haskell - Thu, 10/01/2015 - 5:42pm

  • September 30th, 2015: Now, not only DLists are Functors, for today's #haskell problem we make them Applicative! Come to find that Applied Applicative DLists taste like Apples
  • September 29th, 2015: For today's #haskell problem we look at DLists as Functors! I know! Exciting! and we enfunctorfy DLists ... which are already functions ... ... hmmm ... That sounds like DLists are APPLICATIVE!
  • September 28th, 2015: So we indexed a set of rows last week, let's re(re)cluster them, AGAIN! for today's #haskell problem. And now we re(re)clustered the data, now with colors!
  • September 24th, 2015: Okay, yesterday we indexed rows, so, for today's #haskell problem, let's save and load those rows as CSV
  • September 23rd, 2015: Data Row, o, Data Row: wherefore art thoust identity? Today's #haskell problem adds unique ids for rows of data Simply by using Data.Array we get our data in (uniquely-identified) rows
  • September 22nd, 2015: For today's #haskell problem we go To Infinity ... and Beyond. Yes: we're coding Haskell-on-the-web, yo! simpleHTTP makes HTTP GET-requests, ... well: simple!
  • September 21st, 2015: For today's #haskell problem, we'll fade a circle to black
  • September 17th, 2015: For today's #haskell problem, we receive data one way, but want to see it in another way. What to do? Data. EnCSVified. (that's a word, now)
  • September 16th, 2015: Today's #haskell problem asks 'why JSONify when you can represent clusters yourself?' Why, indeed!
  • September 15th, 2015: For today's #haskell problem we 'unJSONify' some, well, JSON
  • September 14th, 2015: For today's #haskell problem, we relook and recenterclusters from the cluster center So, re-en-cluster-i-fied ... uh: clusters! YAY! (with, ooh! pics!) 
  • September 11th, 2015: Yesterday we displayed one cluster. For today's #haskell problem, let's display them all!
  • September 10th, 2015: This past week we've been clustering data, for today's #Haskell problem we look at visualizing one of these clusters Cluster: shone! ('Schön'? sure!) 
  • September 9th, 2015: Okay, yesterday we clustered some data. For today's #haskell problem: let's see some clustered results, then! It don't mean a thing, ... If it ain't got the (spreadsheet/CSV) schwing.
  • September 8th, 2015: Today we get to do what all those other peeps do in other programming languages. Today we get to WRITE A PROGRAM! wow. I'M K-MEANSIN' ON FIRE TODAY!(okay, geophf, calm down now) A program in Haskell
  • September 7th, 2015: Happy Labor Day in the U.S.A. Today's #haskell problem is to look at recentering clusters for the K-Means algorithm SEMIGROUPOID! (not 'monoid') is the key the solution for today's #haskell problem (ScoreCard has no valid 'zero')
  • September 4th, 2015: Today's #haskell problem we store color-coding for score cards we obtain from rows of data And, color-coded score cards ... SAVED! (makes me wanna scream 'SAIL!')
    <iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="" frameborder="0" height="266" src="" width="320"></iframe>
  • September 3rd, 2015: For today's #haskell problem we look at reclustering the rows of data using K-Means clustering K-Means clustering in #haskell (well, for 1 epoch. Something's not right with step 3: recentered) (and it's DOG-slow)
  • September 2nd, 2015: Drawing information from #BigData is magical, or so says today's #haskell problem Ooh! Big Data is o-so-pretty! But what does it mean? Stay tuned! 
  • September 1st, 2015: For today's #haskell problem we look (obliquely) at the problem of 'indices as identity' What is identity, anyway? 100+ clusters for 3,000 rows? Sounds legit.
Categories: Offsite Blogs

Noam Lewis: Const when you need it

Planet Haskell - Thu, 10/01/2015 - 4:07pm

infernu uses row-type polymorphism to propagate read/write capabilities on record fields. Using row-type polymorphism to describe more than just which fields are present bears a vague resemblance to polymorphic constraints.

In C, a pointer to a field in a const struct is automatically const’ed:

struct foo { int field; }; void useInt(const int *); int main(void) { const struct foo x; useInt(&x.field); // no warnings because &x.field is 'const int *' return 0; }

Thus, a function that extracts a pointer to a (possibly deep) field from a const struct, will also return a const pointer:

const int *getField(const struct foo *x) { return &x->field; }

(All the code compiles with `-Wall` and `-Wextra`)

But, what if I want to use `getField` on a non-const struct, to get an accessor to a field within it? Almost works:

struct foo y; int *bla = getField(&y); *bla = 2;

Uh oh. We get a warning:

warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default] int *bla = getField(&y); ^

The compiler is angry because `int *bla` should be `const int *bla`. But we don’t want that! We just want to get an accessor – a writable accessor – to a field in our not-const struct value.

C++ (not C) does have a non-solution: const_cast. That isn’t what we want: it’s unsafe. What we want is, if a function doesn’t get a const struct, the ‘non-constness’ should propagate to the field accessor being returned (and vice versa: if the given struct was const, so should the accessor).

In fancier words, we need const polymorphism, which I imagine would be written with a ‘constness type variable’ C like this made-up syntax:

const<C> int *getField(const<C> struct foo *x) { return &x->field; }

And then we would expect this to compile with no problems:

struct foo y; int *bla = getField(&y);

…because, as ‘y’ is not const, ergo the pointer returned from getField is not pointing at a const.

Unfortunately, no such thing. We could represent this in a type system in a number of ways. One simple way is to say that constness is a constraint on a type (using something like Haskell’s type classes). Another way is to have ‘write into a field’ be a kind of a capability that’s part of the type.

The latter, write-capability approach is what I use in Infernu. Here there are no structs (it’s JavaScript) but there are polymorphic records. The type system includes two flavors for each field label: Get and Set. If a field is only being read, the record (or object or row) that contains it only needs to have the ‘Get’ accessor for that field. Here’s infernu’s output for a simple example:

// obj : { subObj: { val: Number } } var obj = { subObj: { val: 3 } };

Our object is simple. The comment is what infernu infers, a reasonably simple type.

In the notation I (shamelessly) invented, read-only fields have a prefix ‘get’ in the type, and read/write fields don’t have any prefix. So a read-only field ‘bla’ would be: { get bla : t }. If ‘bla’ is required to be writable, the type is written as { bla : t }. So in the above ‘obj’ example, we see that literal objects are by default inferred to be writable (type annotations would allow you to control that).

Next let’s make a function that only reads ‘subObj’:

// readSubObj : ( { get subObj: h | g} -> h) function readSubObj(x) { return x.subObj; }

The type inferred says “readSubObj is a function, that takes an object with a readable field subObj, (hence “get subObj”: it doesn’t require the ‘Set’ capability!). subObj has any type ‘h’, and the function returns that same type, ‘h’. (By the way, that ‘| g‘ means the passed object is allowed to contain also other fields, we don’t care.)

Example of a nested read:

// readVal : ( { get subObj: { get val: d | c} | b} -> d) function readVal(x) { return x.subObj.val; }

Now we need to ‘get subObj’ but subObj itself is an object with a readable field ‘val’ of type d. The function returns a ‘d’.

We can use readSubObj on a writable object with no problems:

// sub : { val: Number } var sub = readSubObj(obj);

When infernu supports type annotations (eventually) one could take advantage of this type-system feature by marking certain fields ‘get’.

While this isn’t exactly the same as the problem we discussed with C const pointers, the same idea could be used to implement polymorphic constness.

The main idea here is that ideas from row-type polymorphism can be used to implement a certain kind of ‘capabilities’ over types, constraints that are propagated. This may be a nicer way to implement (some kind of) polymorphic constraints.

(For example, in a language that supports row extension/reduction, a function { x : Int | r } -> { | r } would retain the unspecified constraints from ‘r’. I’m sure there are more interesting examples.)

If you can refer me to something like this, please do!

Tagged: Haskell, Infernu, Javascript
Categories: Offsite Blogs

Very dumb beginners question on installation

Haskell on Reddit - Thu, 10/01/2015 - 2:18pm

Hey Haskell peeps. I recently started my first year at college with a major in computer science. I've done some basic coding in the past (we're talking super basic, like HTML and some CSS. Basic.) but these classes are my first time really being introduced to hardcore coding and use of the terminal. For my functional programming course we're learning Haskell, and I'm trying to figure out what to do after downloading the Haskell package. I can't seem to open any sort of compiler or anything, or at least I don't know how. The only guides I can find online are either too outdated or use language that I don't understand (yet!). I'd really appreciate if anyone has any resources to help walk be through the steps one by one, or, if you have the patience and the time, walk me through yourself. Thank you in advance!

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

Enhancing tiling WM (like XMonad)

Haskell on Reddit - Thu, 10/01/2015 - 1:21pm

Hi, I was playing with this idea that is best described by this mockup. Basically, I think one could use Haskell more often to solve small every day problems as he/she uses his favourite WM. What do you think? Is it doable? Can you imagine using it? The possibilities seem endless :)

submitted by jd823592
[link] [17 comments]
Categories: Incoming News

Linear Types Done Right?

Haskell on Reddit - Thu, 10/01/2015 - 11:06am

An interesting sub-discussion spawned by /u/edwardkmett /u/camccann and /u/tel in the "Hask anything" thread about linear typing.

Obviously, there isn't a "right" answer yet, but it'd be interested to see a more explicit discussion on practical/theoretical merits of different approaches.

Personally, I'm quite fond of Levy's Call-by-Push-Value (Levy's original thesis is monolithic, but a good practical discussion are the blog post chain starting here:

In this style, there is a clean distinction between values and computations, and so there are two distinct function types: value arrows (Called representational arrows in "A Universe of Binding and Computation"), which are normal lambda terms, and computational arrows, which can do pattern matching and other effects. Semantically, for value types a,b, value arrows (a -o b) are terms b with a hole of type a (basically data derivatives). for value type a and computation type b, computational arrows (a -> b) can be thought of as popping an 'a' from the stack, and then acting like the computation 'b'. There are adjoint embeddings Thunk, and Return, which respectively turn computations into values, and values into comptations (which push themselves onto the stack). So a normal ML style arrow, for value types a,b, would be a computational arrow (a -> Return b). value arrows are values, so they can be pattern matched unlike opaque functions. They are also linear.

It seems that Thunk and Return are Girard's DownArrow and UpArrow shift connectives (See "focusing on binding and computation") but I must admit I don't understand focusing linear logic well enough to see what that entails.

It also seems like there's a "straightforward" generalization where instead of Returning to a stack, we use named communication channels, memory locations, etc.

I don't have a thesis, just trying to spark discussion.

submitted by dogodel
[link] [44 comments]
Categories: Incoming News

Reading environment variables from user shell

Haskell on Reddit - Thu, 10/01/2015 - 7:47am


My user's shell is fish (I've set it using chsh -s path/to/fish), so all my shell configurations are made in fish configuration files. So all my additional environment variables are set in file. And when I try to get the value of any environment variable set in that file using System.Environment. lookupEnv I am always getting Nothing. Literally.

> lookupEnv "XDG_CONFIG_HOME" Nothing

But it works with HOME (which is not set in

> lookupEnv "HOME" Just "/Users/deadmaya"

Well, I know that I could modify my .profile file and set all variables there, but... Since I really don't use bash, things might become funky if I forget to move my changes.

So... the real question. Is it intended that lookupEnv doesn't use my user's shell or it's just something is broken in my environment?

Thanks in advance!

Update 1

Also I am wondering. If this function uses sh which loads ~/.profile on login only, then... How am I supposed to set XDG_CONFIG_HOME, so lookupEnv finds it?

Update 2

Apparently it's just my environment. I was setting XDG_CONFIG_HOME without exporting it. In fish you need to use set -x for that.

Thanks everyone for help!

submitted by deadmaya
[link] [15 comments]
Categories: Incoming News

Candidate Haskell Platform 7.10.2-a for use with OS X El Capitan

haskell-cafe - Thu, 10/01/2015 - 6:04am
The new OS X El Capitan release (out today) broke the method that Haskell Platform uses to install itself, due to new security features. In fact, if you upgrade your OS, you are also likely to (slightly) break your existing install. There is now a candidate new installer, available at Note that it is unsigned and you will have to give it permission to run, the usual way, by right clicking on it, and choosing "open" then explicitly allowing it to run. The central difference between this and the prior installer is just that it installs symlinks to ghc tools in the /usr/local tree rather than the /usr tree since the latter is now off limits due to new OS X security features. If you have a prior install and just want to "fix" it after your OS upgrade, no need to reinstall the whole platform. Just download and run the activate-hs shellscript from here:
Categories: Offsite Discussion

[unix] POSIX Message Queue support

libraries list - Thu, 10/01/2015 - 3:26am
We've had a request for info regarding message queue support in `unix` [0]. The related headers are currently listed in `System/Posix.hs` under the "Unsupported interfaces" category. Is the community aware of a reason that we have chosen not to support this interface going forward, or is this an artifact from when the library was originally ported (late 2002 by Simon Marlow) which we can now ignore? -- Elliot Robinson GPG Key: 9FEDE59A [0]
Categories: Offsite Discussion

SURVEY: How do you use Hackage?

haskell-cafe - Thu, 10/01/2015 - 1:46am
I recently posted some criticisms of the Haskell User Experience on my site. Afterwards Greshom B. and I had a brief chat over email about any recommendations I had. I suggested that the first step in improving the User Experience of any product is research. I think Hackage is something that needs looking at and we agreed that getting some qualitative data was really important. This survey is an attempt to find out how different people use Hackage. If you're able to participate in the survey, you can either submit a response on this webform <> or submit a response on Reddit <> . If you have any questions or comments please feel free to email: haskell-usability-survey< at > Thanks, Rick Dzekman _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Candidate Haskell Platform 7.10.2-a for use with OS X El Capitan

Haskell on Reddit - Wed, 09/30/2015 - 10:58pm

The new OS X El Capitan release (out today) broke the method that Haskell Platform uses to install itself, due to new security features. In fact, if you upgrade your OS, you are also likely to (slightly) break your existing install.

There is now a candidate new installer, available at

Note that it is unsigned and you will have to give it permission to run, the usual way, by right clicking on it, and choosing "open" then explicitly allowing it to run.

The central difference between this and the prior installer is just that it installs symlinks to ghc tools in the /usr/local tree rather than the /usr tree since the latter is now off limits due to new OS X security features.

If you have a prior install and just want to "fix" it after your OS upgrade, no need to reinstall the whole platform. Just download and run the activate-hs shellscript from here:

Again, after a bit more testing we'll get this signed and released as the new official platform installer for OS X, but in the meantime, I wanted to make sure people were in the loop.

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