News aggregator

Philip Wadler: Haskell in XKCD

Planet Haskell - Fri, 01/03/2014 - 5:21am
Haskell appears in XKCD. Is this an auspicious sign for the New Year? Click through for the tool tip.

Categories: Offsite Blogs - Fri, 01/03/2014 - 4:05am
Categories: Offsite Blogs

Philip Wadler: Scots have nothing to lose going the ‘indy’ route

Planet Haskell - Fri, 01/03/2014 - 3:00am
Iain Robertson presents a concise summary of the argument for Scottish independence. From The Japan Times of all places, and March 2013 of all times.Under the current devolved settlement, Scotland has a parliament sitting in Holyrood, Edinburgh, which controls a paltry 16 percent of the country’s tax base. The game-changing economic and social policy levers remain in the hands of the U.K. government, leaving Scotland unable to properly tackle some of its social ills or take full advantage of its many natural resources.
Scotland’s union with England and the other parts of the U.K. is not offering Scots the best option. The current political landscape across the nations of the U.K. is one where Westminster is controlled by a Conservative-Liberal coalition government that was roundly rejected by Scottish voters at the last election; just one Conservative member of Parliament hails from a seat north of the border.
Recent figures revealed in “The Government Expenditure and Revenue Scotland 2011-12 Report” show that, rather than enjoying handouts, Scotland is paying more money in tax than it receives in U.K. public spending, to the tune of around £863 per head of its population.
Newspapers the length and breadth of the U.K. continue to run baseless front-page scare stories about independence. What many of these failing newspapers make clear is that the so-called “union” of countries is viewed by London as being one they control.
There is even more to Scotland’s economic potential as an independent country than its booming oil and renewable energy industries. It has a number of world- class business sectors; including food and drink, life sciences and a first-class education system. Scotland has much to offer — both to itself and the world.
There is even more to Scotland’s economic potential as an independent country than its booming oil and renewable energy industries. It has a number of world- class business sectors; including food and drink, life sciences and a first-class education system. Scotland has much to offer — both to itself and the world.
As Scots singer Eddie Reader retweeted: “indy (independence) gives us uncertainty with power, U.K. gives uncertainty without power.”
Categories: Offsite Blogs - Fri, 01/03/2014 - 2:55am
Categories: Offsite Blogs

xkcd: Haskell

Haskell on Reddit - Thu, 01/02/2014 - 11:01pm
Categories: Incoming News

Designing somewhat-type-safe RPC

haskell-cafe - Thu, 01/02/2014 - 10:30pm
Hi, While working on the design of an RPC library (for an existing protocol), I got somewhat stuck. The system is fairly simple: for some call, a client first sends an identifier of the call, followed by a serialized form of the argument. Then the server returns some serialized result. A server exposes several procedures, all taking a certain argument type and returning a certain result type. Below is some code which sketches my current approach. The 'client' side seems straight-forward and working (hence 'runCall'), but I didn't manage to implement the server side as I imagine it to be (i.e. the parts commented out). Any pointers would be appreciated. Thanks, Nicolas {-# LANGUAGE GADTs, RankNTypes, OverloadedStrings, KindSignatures, ScopedTypeVariables #-} module RPC where import Data.Word (Word32) import Data.Binary (Binary, decode, encode) class RPC (a :: * -> * -> *) where rpcProcedureId :: a req res -> Word32 {- rpcProcedure :: Word32
Categories: Offsite Discussion

<*> with two different functors

Haskell on Reddit - Thu, 01/02/2014 - 12:03pm

I was wondering whether there's an abstraction like <*> but with two (or even three, if it's generic in the return type) different functors, and whether it would be useful.

An example instance that combines List and Maybe could treat the maybe value as a list of 1 or 0 elements. List and Tree could be combined by flattening the tree, or by seeing the list as a tree without depth. I've done these conversions by myself a few times and there must be a bunch of other useful ways datatypes can be combined for real life applications. But does it make any sense from a mathematical viewpoint? How would you call it?

For the record, f (a -> b) -> g a -> h b doesn't show any hits on Hackage.

Edit: And yes, I'm very much interested in related concepts. XY problem and all that.

submitted by vincentrevelations
[link] [12 comments]
Categories: Incoming News

Dominic Steinitz: Fundamental Group of the Circle

Planet Haskell - Thu, 01/02/2014 - 10:51am

While on holiday, I started reading a couple of on-line texts on algebraic topology on my Kindle (Hatcher 2002), (May 1999). Kindle’s aren’t great for reading maths but they save having to carry around heavy books of which one might only read a fraction. Along with the usual holiday activities (ok not that usual as we did cycle into Burma), I made it as far as calculating the fundamental group of the circle, .

The idea is that two continuous functions are homotopic if they can be deformed continuously into each other. All functions from now on are considered continuous unless otherwise specified.

More formally if are homotopic then there exists a function such that and .

A path is a map where is the unit interval . A homotopy of paths is a function such that and . We write . The two paths and are homotopic and we write . Homotopy of paths is an equivalence relation, a fact which we do not prove here. The equivalence class of a path is denoted .

Where the end point of one path is the start point of another path, we can join these together to form new paths. This joining operation respects homotopy classes as the diagram below illustrates.

A loop is a path with .

We can join loops based at the same point together to form new loops giving a group operation on equivalence classes under homotopy. In more detail, suppose that and are loops then we can form the new loop which is the obvious loop formed by first traversing and then traversing . The inverse of the loop is the loop and the identity is the constant loop . The way we have defined homotopy ensures that this is all well defined (see either of the on-line books for the details).

The group of loops under these group operations is called the fundamental group or the first homotopy group and is denoted .

Theorem where the latter denotes the integers with the group structure being given by addition.

Proof Define


that is for each integer we define an equivalence class of loops. In more standard notation (not using as a way of introducing anonymous functions)


Further we have and clearly . Thus making a homomorphism.

We wish to show that is an isomorphism. To do this we are going to take a loop on and lift it to a path on so that the map which wraps around the circle projects this lifted map back to the original map: . Since we must have that for some integer (this will be the number of times the loop winds around the origin). Let us call the map that creates this integer from a loop on the circle

Note that we also have so the lifted path could start at any integer. For the sake of definiteness let us start it at .

We now construct this map, , show that it is well defined and is a homomorphism.

We know that is a smooth manifold. Let us give it an atlas.

We define the co-ordinate maps as . The transition maps are then just a translation around the circle. For example

And these are clearly smooth.

By continuity of , every point in is contained in some open interval whose map under is contained in one of the charts. This gives an open cover of . By the compactness of (it is closed and bounded), we therefore have a finite subcover. From this we can construct such that for some and .

Since we could to define . But how do we define beyond ?

We know that

where is a homeomorphism from each to .

So we can equivalently define

where has been chosen to contain .

Given our specific atlas we have

Suppose we have the loop , then we could define

So that

And now we know how to continue. There must be a such that .

So we can define

where has been chosen to contain .

Given our specific atlas we have

With our specific example we could define

So that (again)

Continuing in this fashion, after a finite number of steps we have defined on the entirety of . Note that this construction gives a unique path as at each point the value of on is uniquely determined by its value at (and of course by itself).

We still have a problem that if is homotopic to then might not equal .

Assume we have a homotopy then since is compact we can proceed as above and choose a partition of of rectangles

with , , and such that for some .

Thus we can define on as

where has been chosen to contain .

We can continue as before; we know there must be a such that so we can define

where has been chosen to contain for all using the previously defined .

Eventually we will have defined on the whole of . But now we can start the same process for and by choosing to be the value of the previously defined and by the uniquess of lifts of paths we can define on the whole of .

Carrying on in this way we will have defined on the whole of .

and must be constant paths because for all (constant lifted paths get projected onto these and they are unique).

Since we require that , we must have that .

By the uniquess of lifted paths we must then have

Since is constant we must have that . Thus is well defined on homotopy classes.

Recall that so that so that is a homomorphism.

Suppose that then with a homotopy of loops. This lifts to a unique homotopy of paths with and . Since is a homotopy of paths, the end point is fixed. Thus and is injective.

Suppose that is a loop starting at 1 then there is a lift starting at . We also have that by the linear homotopy . Thus and is surjective.


Hatcher, A. 2002. Algebraic Topology. Tsinghua University.

May, J.P. 1999. A Concise Course in Algebraic Topology. Chicago Lectures in Mathematics. University of Chicago Press.

Categories: Offsite Blogs - Thu, 01/02/2014 - 2:23am
Categories: Offsite Blogs