News aggregator

The Gentoo Haskell Team: 7.8.1-rc1 Gentoo experience

Planet Haskell - Sat, 02/08/2014 - 1:24pm

A week ago Austin Seipp and GHC team announced first release candidate from 7.8 branch.

As a packager I was especially interested in following features:

  1. GHCi (and dynamic linking) on unregisterised arches, like ia64 and powerpc64
  2. jobs argument for ghc make. Parallel builds for free.
  3. what did seriously break, what was fixed?

First off, -rc1 is packaged in gentoo-haskell overlay (not keyworded as quite a bit of packages fail to build against ghc-7.8).

GHCi (and dynamic linking)

Dynamic linking works like a charm! GHCi loads binaries noticeaby faster. Let’s test it! Simplest synthetic test: how fast do you get prompt from interpreter?

# ghc-7.6: $ time { echo '1+1' | ghci -package yesod-core >/dev/null; } real 0m0.626s user 0m0.550s sys 0m0.074s # ghc-7.8: $ time { echo '1+1' | ghci -package yesod-core >/dev/null; } real 0m0.209s user 0m0.172s sys 0m0.034s

It’s a case, when files are cached in RAM. 3-4 times faster. The same boost should apply every time when you compile something template-haskell related.

jobs argument for ghc make

I’ve went ahead and tried to enable it for all ebuilds.

For some reason ghc eats a lot of system time in that mode. Likely jobs without arguments is not very good idea and i’ll need to limit it by minimum of MAKEOPTS value and some N (Cabal picked 64).

Even in this mode 2-time speedup is visible on large packages.

So what did break?

Not _that_ much, actually.

alex and happy generated parsers

All package maintainers who ship lexers generated by alex and parsers generated by happy are strongly advised to update those tools locally and reissue hackage update, as old parsers do not compile against ghc-7.8.

If you have happened to use low-level

(==#) :: Int# -> Int# -> Bool

primitives, you might need to port your code a bit, as how their type is a bit different:

(==#) :: Int# -> Int# -> Int#

Here is our example fix for arithmoi.

Type inference changed a bit.

Traditionally darcs needed a patch :] In that big mostly dumb patch most interesting bit is explicit assignment:

- where copyRepo = + where copyRepo :: IO () + copyRepo =

Even more amusing breakage was in shake, where error was in inability to infer Addr# argument. No idea was it a bug or feature.

Unsafe removals

As we’ve seen in darcs patch many unsafe${something} functions went away from Foreign modules down to their Unsafe counterparts.


Typeable representation did change in a substantial way, thus advanced generic stuff will break. I have no example fix, but have a few of broken packages, like dependent-sum.

Hashtable gone from base

Example of fix for frag package. By the way, ghc-7.6 used to eat 8GBs of RAM compiling frag. For ghc-7.8 it was enough 700MBs even for 8 building threads.

Compiler itself

The thing I expected to try didn’t compile: unregisterised arches and GHCi on them.

I’ve hacked-up a workaround to make them build, but in threaded RTS mode it still SIGSEGVs.

STG gurus are welcome to help me :]

I have fundamental questions like:

  • can unregisterised builds support SMP in theory? (via __thread attribute for example)
  • did UNREG ever produce working threaded runtime?
$ cat __foo/foo.hs main = print 1 # non-threaded works, as always been $ inplace/bin/ghc-stage1 --make __foo/foo.hs -threaded -debug -fforce-recomp # $ gdb --args ./__foo/foo +RTS -D{s,i,w,g,G,b,S,t,p,a,l,m,z,c,r} ... (gdb) run ... 7ffff7fb9700: resuming capability 0 7ffff7fb9700: cap 0: created thread 1 7ffff7fb9700: new bound thread (1) 7ffff7fb9700: cap 0: schedule() 7ffff7fb9700: cap 0: running thread 1 (ThreadRunGHC) Jumping to 0x7ec17f # Program received signal SIGSEGV, Segmentation fault. 0x00000000007ec1a2 in stg_returnToStackTop () (gdb) bt #0 0x00000000007ec1a2 in stg_returnToStackTop () #1 0x00000000007d26d9 in StgRun (f=0x7ec17f , basereg=0xca0648) at rts/StgCRun.c:81 #2 0x00000000007c7a30 in schedule (initialCapability=0xca0630, task=0xcc3b30) at rts/Schedule.c:463 #3 0x00000000007ca2c4 in scheduleWaitThread (tso=0x7ffff6b05390, ret=0x0, pcap=0x7fffffffd218) at rts/Schedule.c:2346 #4 0x00000000007c0162 in rts_evalIO (cap=0x7fffffffd218, p=0xb61450 , ret=0x0) at rts/RtsAPI.c:459 #5 0x00000000007e04c3 in ioManagerStartCap (cap=0x7fffffffd218) at rts/posix/Signals.c:184 #6 0x00000000007e04f6 in ioManagerStart () at rts/posix/Signals.c:194 #7 0x00000000007d1d5d in hs_init_ghc (argc=0xc96570 , argv=0xc96578 , rts_config=...) at rts/RtsStartup.c:262 #8 0x00000000007d000b in real_main () at rts/RtsMain.c:47 #9 0x00000000007d0122 in hs_main (argc=17, argv=0x7fffffffd418, main_closure=0xb527a0 , rts_config=...) at rts/RtsMain.c:114 #10 0x0000000000404df1 in main ()

Looks like CurrentTSO is complete garbage. Should not happen :]


The experience is positive. I already get bored, when see single-threaded make of ghc-7.6 and want to update a compiler.

Things like yesod, darcs, hoogle, pandoc and xmonad build fine, thus you can get working environment very fast.

Package authors are more eager to fix stuff for this release: it turns bug lookup and benchmarking into very interactive process.

I want to thank All Of You to make push haskell forward!

Thank you!

Categories: Offsite Blogs

Philip Wadler: Off the Beaten Track 3: Proofs as Stories

Planet Haskell - Sat, 02/08/2014 - 10:08am
A third talk of note at Off the Beaten Track was Languages for Computational Creativity: Generative Art and Interactive Worlds, by Chris Martens. Her talk included the most inventive application of Propositions of Types that I ever heard: Proofs as Stories. Later, she provided a citation to a longer work, Linear Logic for Non-Linear Storytelling, by some of her collaborators, which uses proofs in linear logic to describe alternative storylines for Madame Bovary. Thanks, Chris!

Categories: Offsite Blogs

Philip Wadler: Off the Beaten Track 2: Take FRP to the limit

Planet Haskell - Sat, 02/08/2014 - 9:39am
A second talk I enjoyed at Off the Beaten Track was Kengo Kido's Integrability in Nonstandard Modeling of Hybrid Systems, because it might hold the secret to resolving a conflict that has bugged me for many years.

Elliott and Hudak's original description of Functional Reactive Animation carefully separated behaviours (continuous maps from time to values) from events (a value is supplied at a given time). However, many developments of Functional Reactive Programming (FRP) instead supply a stream of discrete values, casting out continuity and conflating the notions of behaviour and event. For instance, the discrete approach is taken by Causal Commutative Arrows and by Asynchronous Functional Reactive Programming for GUIs (the basis for Elm).

As I commented in a previous post, streams have the advantage of permitting feedback loops, which permit the definition of important functions such as integral, and relate to the categorical notion of trace: can we combine the advantages of feedback with continuity? Kido's paper suggests a way forward: use discrete streams, but let the time interval between them to approach zero in the limit, as in his language WHILEdt. It would be great to see someone work out the details.

Categories: Offsite Blogs

What are some common "design patterns" when it comes to creating large-scale Haskell programs?

Haskell on Reddit - Sat, 02/08/2014 - 9:12am

I saw a similar question asked a few days ago, but it was a bit more specialized and got pretty specific responses.

I've read Tekmo's posts on the Functor and Category design patterns, but I'm curious to read more. I've structured a few of my own semi-large programs and its pretty common for to see some redundancy and recognize that I can abstract things away. But, I'm not aware of any real overarching patterns that people might use when they start a project to make everything fit together nicely.

I've noticed a couple of things in OSS, etc, where people tend to create their own specialized monad transformer stack, give it a newtype declaraction and use it throughout, and some applications create their own new monads, etc.

But apart from this, it's hard to pin down any real schemes for design. I'm asking because I'm one of those people who tends to plan a little bit, then program a little bit to make sure everything works the way I want it to, then repeat. But this leads to me reworking ideas I had previously a lot, because they don't quite fit. I learn from them, though, and wouldn't be able to complete a design document without that knowledge. I'm looking for something to read that can help me avoid some of this -- i.e. give me a decent functional scheme for designing programs in the large. Does anyone have advice or resources related to this?


submitted by 5outh
[link] [46 comments]
Categories: Incoming News

Philip Wadler: Union in Peril?

Planet Haskell - Sat, 02/08/2014 - 8:10am
It's easy to despair if you favour independence for Scotland. Despite a small slant toward Yes, polls still show No well in the lead. So I found heartening a call to arms by Alan Massie in the Spectator, warning unionists that a vote for Independence is far from far fetched.
Alex Salmond is within striking distance of victory. Why hasn’t England noticed?
Categories: Offsite Blogs - Sat, 02/08/2014 - 7:37am
Categories: Offsite Blogs - Sat, 02/08/2014 - 7:37am
Categories: Offsite Blogs

ANN: Wheb -- A WAI framework

haskell-cafe - Fri, 02/07/2014 - 8:07pm
Hello all, I was rather frustrated with the use of Template Haskell as the main entry point for the big framework projects (Yesod, Snap, etc.) While these frameworks offer template-free options, they seem like second class citizens. So I started work on Wheb with the goal that out of the box I could start a project quickly, without Template Haskell and without the dreaded long list of Language Pragma's at the top. I was inspired by the simplicity of the Scotty project which showed how easy a Haskell server could be to write. I have included a couple of plugin examples for handling Auth and Sessions. Wheb is database and template agnostic, but I plan to write some plugins soon to make it easier to use the major libraries with Wheb. I just started work on it last weekend but wanted to share my progress. Take a look if it interests you! Thanks, Kyle Hanson _______________________________________________ Haskell-Caf
Categories: Offsite Discussion

The Essence Of Reynolds

Haskell on Reddit - Fri, 02/07/2014 - 5:11pm
Categories: Incoming News

Lazy Lambda Calculus implementation

haskell-cafe - Fri, 02/07/2014 - 4:27pm
Hello all, I've written the following implementation of Lambda Calculus, which will evaluate its Terms non-strictly. I've verified this since the Y combinator works without diverging: data Term a = Const a | Var Nat | Lam (Term a) | Term a :< at > Term a data Val a = C a | F (Partial (Val a) -> Partial (Val a)) type Env a = [Partial (Val a)] eval' :: Term a -> Env a -> Partial (Val a) eval' (Const c) env = Now (C c) eval' (Var n) env = let Just x = lookUp env n in x eval' (Lam f) env = Now (F (\a -> eval' f (a:env))) eval' (f :< at > x) env = do F f' <- eval' f env Later (f' (eval' x env)) eval t = eval' [] t Nat, Partial, lookUp, etc. have pretty obvious implementations. My question is, will this behave lazily? In other words will the contents of the 'env' lists be shared between the different contexts, such that forcing an element the be evaluated twice will only perform the evaluation once? Note that the first "do" line is the only
Categories: Offsite Discussion

Roman Cheplyaka: My Haskell will

Planet Haskell - Fri, 02/07/2014 - 4:00pm

I hate it when maintainers become unreachable. At the same time, I’m not immune to that myself (if nothing else, I could be hit by a bus tomorrow).

So I contacted a few people with a request to become backup maintainers (BM) for some of my more popular Haskell packages, and they kindly agreed. Specifically:

  • Oliver Charles is now BM for all my testing-related packages: tasty and its add-ons, smallcheck, obsolete test-framework add-ons, and ansi-terminal (a dependency of tasty)
  • Adam Bergmark is now BM for the haskell-suite projects: haskell-names, haskell-packages, hse-cpp, and traverse-with-class (a dependency of haskell-names)
  • Sjoerd Visscher is co-BM for traverse-with-class
  • Oleksandr Manzyuk is now BM for ariadne and bert (a dependency of ariadne)

Being a backup maintainer comes with very light responsibilities:

  • should I become unreachable (temporarily or permanently), and a change has to be made to a package to keep it usable, the BM is supposed to review, apply, and release that change.
  • if I am unreachable for a long time or permanently, and there’s a person/people who want to take over maintenance/development of all or some of the packages, and the BM has no objections to them doing so, the BM is supposed to give them the necessary privileges. (Of course, that person may be the BM him/herself!)

The BM for a package is added as a maintainer of that package on hackage and as a collaborator for the package’s github repository.

To make it clear, there’s no obligation for the BM to fix bugs or continue the development after I disappear. It would be unreasonable to request a person to commit to such a responsibility at an indefinite point in the future.

I assume that if a project is important, there will be people willing to take care of it; and if it isn’t, then it doesn’t matter anyway. The main responsibility of the BM is thus to make it easy for such a hypothetical person to take over.

As to what it means to be «unreachable», I completely trust my BM’s judgement here. I don’t want them to follow any bureaucratic procedures. The risk of something going wrong is very low and easily outweighed by the benefits of timely response to problems.

One package that doesn’t have a BM yet is standalone-haddock. If you use it and would like to become a BM, please get in touch.

I also encourage other package maintainers to follow this example and appoint BMs for their popular packages.

Categories: Offsite Blogs

Magnus Therning: Localised configuration in Vim: localcfg

Planet Haskell - Fri, 02/07/2014 - 2:00pm

For quite a while I’ve been using a small Vim plugin that lets me write configuration that is specific to a system, it loaded a config file based on the system’s host name. Unfortunately I can’t seem to find that plugin anywhere now, so I’ve put it in a snippet. This allowed me to easily create a single clean Vim configuration and check it into version control, while still allowing for settings that are unique to a system.

Lately I’ve found it slightly limited though, I really wanted to use other things to trigger the loading of some piece of configuration. So I wrote my first ever Vim plugin: localcfg

Hopefully someone will find it useful.

Categories: Offsite Blogs

Wheb -- A WAI framework.

Haskell on Reddit - Fri, 02/07/2014 - 12:41pm

I was rather frustrated with the use of Template Haskell as the main entry point for the big framework projects (Yesod, Snap, etc.) While these frameworks offer template-free options, they seem like second class citizens. So I started work on Wheb with the goal that out of the box I could start a project quickly, without Template Haskell and without the dreaded long list of Language Pragma's at the top. I was inspired by the simplicity of the Scotty project which showed how easy a Haskell server could be to write.

I have included a couple of plugin examples for handling Auth and Sessions. Wheb is database and template agnostic, but I plan to write some plugins soon to make it easier to use the major libraries with Wheb.

I just started work on it last weekend but wanted to share my progress. Take a look if it interests you!

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

I wrote a simple <200 line Forth interpreter. Does anyone have any suggestions?

Haskell on Reddit - Fri, 02/07/2014 - 12:14pm

the majority of coding i do is in python and c, so i decided to build a forth interpreter in haskell to get back into it. i feel like my haskell code is improving (especially since i learned about lambdabot's @pl function (just kidding)) but if any more advanced haskellers have any ideas for me, i'd be glad to hear them.

the interpreter is here:

it just features the basics, like allowing you to declare words, conditionals, and a couple of primitives. i plan on adding loops soon, i just haven't read through that chapter of "starting forth" yet :)

submitted by nycs
[link] [4 comments]
Categories: Incoming News

A test driven haskell course

Haskell on Reddit - Fri, 02/07/2014 - 11:25am
Categories: Incoming News

Filing bugs for haskell packages

haskell-cafe - Fri, 02/07/2014 - 10:08am
Hello! I am new to haskell and I found a bug in package On the hackage page it says that the maintainer e-mail of this package is: libraries< at > So i sent a bug report there, but bounced back to me because of quota. So apparently nobody reads these e-mails. How can I file a bug report for this package? I don't feel good enough in haskell to try and fix it myself. Greetings Szymon Pyżalski _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Simon Peyton Jones to be knighted?

Haskell on Reddit - Fri, 02/07/2014 - 8:34am

There is a post on hackernews that says SPJ is to be knighted. Can anyone verify? If true congratulations to Simon.

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

language-puppet: Version 0.12.0 : GHC 7.8 and performance increase

Planet Haskell - Fri, 02/07/2014 - 6:50am

I just released version 0.12.0, which should compile on GHC 7.8 once the following packages are fixed :

  • regex-pcre-builtin (Edit 2014/02/09: now updated)
  • strict-base-types (Edit 2014/02/09: now updated)
  • charset (There is a pull request under way)

It seems to compile fine against GHC 7.6.3, even though I couldn’t really test the resulting executable (I gave a shot at Nix, but hruby is somewhat broken as a result).

This release doesn’t bring much on the table apart from an hypothetical 7.8 compatibility.

I made several claims of performance increase, previously, so here are the results :

0.10.5 0.10.6 0.11.1 0.12.0 49 nodes, N1 10.74s 9.76s 9.03s 49 nodes, N2 10.48s 7.66s 7.01s 49 nodes, N4 9.7s 6.89s 6.37s 49 nodes, N8 12.46s 13.4s 11.77s Single node 2.4s 2.24s 2.02s 1.88s

The measurements were done on my workstation, sporting a 4 cores HT processor (8 logical cores).

The performance improvements can be explained in the following way :

  • Between 0.10.5 and 0.10.6, the Ruby interpreter mode of execution was modified from a Channel based system to an MVar one.
  • Between 0.10.6 and 0.11.1, all systems that would run on their own thread were modified to use the calling thread instead, reducing synchronization overhead (except for the Ruby thread). This gave a 9% performance boost for single threaded work, and a 29% performance boost when using four cores. The 8-cores performance worsened, because of the wasted work of the parser (This is explained in the previous post).
  • Between 0.11.1 and 0.12.0, I moved from GHC 7.6.3 to GHC 7.8-rc1, and bumped the version of many dependencies (including text and aeson, both having received a speed boost recently). This resulted in a “free” 7% speed boost.

As it is shown here, the initial parsing is extremely costly, as computing the catalogs for 49 nodes is about 5 times as long as computing it for a single node. As the parsed files get cached, catalog computing becomes more and more effective (about 50 times faster than Puppet). I don’t think the current parser can be sped up significantly without ditching its readability, so this is about as fast as it will get.

The next goals are a huge simplification of the testing system, and perhaps an external DSL. There are compiled binaries and ubuntu packages at the usual place.

Categories: Offsite Blogs

ETAPS 2014 call for participation

General haskell list - Fri, 02/07/2014 - 1:45am
To notice: - The programme of the main conferences of ETAPS 2014 is on the web. - Early registration is until Friday, 14 February 2014. ****************************************************************** CALL FOR PARTICIPATION ETAPS 2014 17th European Joint Conferences on Theory And Practice of Software Grenoble, France, 5-13 April 2014 ******************************************************************
Categories: Incoming News