News aggregator

24 Days of GHC Extensions - Tue, 12/23/2014 - 12:21am
Categories: Offsite Blogs

24 Days of GHC Extensions - Tue, 12/23/2014 - 12:21am
Categories: Offsite Blogs

Manuel M T Chakravarty: New version of BigPixel

Planet Haskell - Mon, 12/22/2014 - 8:57pm
New version of BigPixel:

New version of BigPixel — my iPad app for pixel art and retro sprites (with a new colour picker and sprite preview). I use BigPixel when teaching kids programming by writing small games. Creating art and programming works nicely in tandem — for details of what I do with Haskell, see

Categories: Offsite Blogs

What is an extensive list of data structures one can use in place of JavaScript/Python's arrays?

Haskell on Reddit - Mon, 12/22/2014 - 8:11pm

JavaScript/Python's arrays can be used everywhere as a silver bulet O(1) read/write structure. In Haskell, there is a wide range of solutions that vary on complexity and purity. I'm looking for an extensive list covering all the options in order to make the right decision when I need to.

Edit: downvotes, a dozen of comments, not a single actual answer. Did I do something wrong?

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

Haskell Poll Results - Mon, 12/22/2014 - 7:24pm
Categories: Offsite Blogs

Haskell Poll Results - Mon, 12/22/2014 - 7:24pm
Categories: Offsite Blogs

Danny Gratzer: What Are Impredicative Types?

Planet Haskell - Mon, 12/22/2014 - 6:00pm
Posted on December 23, 2014 Tags: haskell, types

So the results from Stephen’s poll are in! Surprisingly, impredicative types topped out the list of type system extensions people want to talk about so I figured I can get the ball rolling.

First things first, all the Haskell code will need the magical incantation

{-# LANGUAGE ImpredicativeTypes #-} What Is Impredicative Polymorphism

We have a lot of extensions that make polymorphism more flexible in Haskell, RankNTypes and Rank2Types spring to mind. However, one important feature lacking is “first class polymorphism”.

With impredicative polymorphism forall’s become a normal type like any other. We can embed them in structures, toss them into polymorphic functions, and generally treat them like any other type.

Readers with a mathematical background will wonder why these are called “impredicative” types then. The idea is that since we can have polymorphic types embedded in other structures, we could have something like

type T = (Int, forall a. a -> Int)

That a could assume any time including T. So each type definition can quantify over itself which nicely corresponds to the mathematical notion of impredicativity.

One simple example where this might come up is when dealing with lenses. Remember lenses have the type

type Lens {- viciously -} s t a b = forall f. (a -> f b) -> s -> f t

If we were to embed lenses in let’s say a tuple,

type TLens a b = (Lens a a (a, b) (a, b), Lens b b (a, b) (a, b)) foo :: TLens Int Bool foo = (_1, _2)

We’d need impredicative types because suddenly a polymorphic type has appeared within a structure.

Why No One Uses It

Now that we’ve seen how amazing impredicative polymorphism, let’s talk about how no one uses it. There are two main reasons

  1. GHC’s support for impredicative types is fragile at best and broken at worst
  2. Avoiding the need for impredicative types is very straightforward

Reason 1 isn’t exactly a secret. In fact, SPJ has stated a number of times that he’d like to deprecate the extension since it’s very hard to maintain with everything else going on.

As it stands right now, our only choice is more or less to type check a program and add type signatures when GHC decides to instantiate our beautiful polymorphic type with fresh monomorphic type variables.

For this reason alone, impredicative types aren’t really the most useful thing. The final nail in the coffin is that we can easily make things more reliable by using newtypes. In lens for example we avoid impredicativity with

newtype ScopedLens s t a b = ScopedLens {getScopedLens :: Lens s t a b}

This means that instead of impredicative types we just need rank N types, which are much more polished.

Wrap Up

Well, I’m sorry to be the bearer of bad news for those who filled out -XImpredicativeTypes on the poll, but there you are.

To end on a positive note however, I do know of two example of where impredicative types did save the day. I’ve used impredicative type exactly once to handle church lists properly. Lennart Augustson’s Python DSL makes heavy use of them to present a unified face for variables.

<script type="text/javascript"> var disqus_shortname = 'codeco'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + ''; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript> comments powered by Disqus
Categories: Offsite Blogs

Cross-compiling hackage packages for ARM?

Haskell on Reddit - Mon, 12/22/2014 - 5:51pm

I'm looking for some input on how to improve my current usage of cabal on ARM. I've an ARM laptop I use for "everything", which makes cabal builds quite tedious and slow. Lately breakage (cabal hell) has consumed a lot of my time in rebuilds, etc. Yet sandboxing is also very time consuming. I've access to fast remote servers, though.

Is there a way to build cabal packages remotely on an x86_64 server (QEMU?), and later install the packages locally?

submitted by jarlg
[link] [9 comments]
Categories: Incoming News

[SERIOUS] I understand Haskell is awesome, but what is the point if you can't use it to write: apps, web-apps, front-end software, and anything people will actually use?

Haskell on Reddit - Mon, 12/22/2014 - 3:47pm

I understand Haskell is the greatest language etc. etc. for server programming, but what is the point in learning it if you can't write games and apps? "Bad" languages like Java, C# and JavaScript at least can be used to build things that people will actually use. Why is there no functional language developed with front-end in mind?

edit: it was just a question, why are you all so angry?

submitted by LamXX_LamXX
[link] [21 comments]
Categories: Incoming News

Russian Lambda Planet - Mon, 12/22/2014 - 3:33pm
Categories: Offsite Blogs