News aggregator

Where does GHC spend most of it's time during compilation?

Haskell on Reddit - Wed, 03/25/2015 - 8:04am

I'm just wondering what contributing factors result in long compile times for GHC (with the exception of Template Haskell). Is it things like type checking & analysis, is it the codegen process, or whatever.

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

FP Complete: FP Complete's Hackage mirror

Planet Haskell - Wed, 03/25/2015 - 8:00am

We have been running a mirror of Hackage package repository which we use internally for the FP Complete Haskell Centre's IDE, building Stackage, and other purposes. This has been an open secret, but now we're making it official.

To use it, replace the remote-repo line in your ~/.cabal/config with the following:

remote-repo: hackage.fpcomplete.com:http://hackage.fpcomplete.com/

Then run cabal update, and you're all set.

This mirror is updated every half-hour. It is statically hosted on Amazon S3 so downtime should be very rare (Amazon claims 99.99% availability).

The mirror does not include the HTML documentation. However, Stackage hosts documentation for a large set of packages.

We have also released our hackage-mirror tool. It takes care of efficiently updating a static mirror of Hackage on S3, should anyone wish to host their own. While the official hackage-server has its own support for mirroring, our tool differs in that it does not require running a hackage-server process to host the mirror.

HTTPS for Stackage

On a tangentially related note, we have enabled TLS for www.stackage.org. Since cabal-install does not support TLS at this time, we have not set up an automatic redirect from insecure connections to the https:// URL.

Categories: Offsite Blogs

What are your most persuasive examples of using Quickcheck?

Haskell on Reddit - Wed, 03/25/2015 - 5:32am

I'm writing documentation for my Python Quickcheck-like library, Hypothesis and I'm looking for examples of using Quickcheck that are a little more persuasive than reversing a list or checking commutativity of numbers.

In particular I'm looking for examples that make people go "Oh, I could totally use this in $DAYJOB". I find most quickcheck examples seem to start from the assumption that you're writing a library, which most people aren't.

The examples I have so far are:

But I'd really like more, particularly ones from domains where you wouldn't necessarily think to have used Quickcheck, or ones with a certain "wow!" factor.

submitted by DRMacIver
[link] [45 comments]
Categories: Incoming News

Command Line Args passed to wxHaskell

haskell-cafe - Wed, 03/25/2015 - 4:20am
I am seeing strange behavior with a wxHaskell app compiled on Windows 7. On Linux, all is well. I can call my app like: app +RTS -N4 -RTS myArg And in the app I can process the myArg and start a wxHaskell frame. When I compile the same application on Windows 7, I get an error dialog box that says: “Unexpected parameter `+RTS`. And a second Usage dialog that looks like it comes from wxHaskell. I am not sure why Windows is different, but perhaps it is the fact that on Windows 7 I compiled up wxHaskell 0.92, and on Linux I used 0.91 from a cabal update. I used 0.92 on on Windows because I could not get 0.91 to compile due to some type problems where the wxPack version was incompatible with a header file and the Haskell compiler related to 64 bit types long long. There is some noise about this on the web, but no solutions. Nonetheless, I assume that args are grabbed directly by wxHaskell and Environment.getArgs does not consume them such that they are still available to wxHaskell. Is there some way to
Categories: Offsite Discussion

attoparsec and (binary|cereal)

Haskell on Reddit - Wed, 03/25/2015 - 3:09am

Hi there, so I'm a beginner (don't blame :D) trying to write a parser for apache kafka log files. Those files are written in binary format containing messages with the following structure:

8 byte message offset number 4 byte size containing an integer N 4 byte CRC32 of the message 1 byte "magic" identifier to allow format changes, value is 2 currently 1 byte "attributes" identifier 4 byte key length, containing length K (K byte key) -- doesn't exist in our case for the moment 4 byte payload length, containing length V V byte payload

Since performance matters, I made a first attempt with attoparsec library which seems suitable at this place to me. Now I'm facing 2 problems: laziness and error handling.

For my questions, showing there the first two fields will be enough. Here is my first attempt with the take N function:

entryParser :: Parser LogEntry entryParser = do o <- offsetParser l <- lengthParser lengthParser :: Parser Length lengthParser = do l <- take 4 offsetParser :: Parser Offset offsetParser = do o <- take 8

So first of all I have to decode the taken bytestrings into Int64 for offset field and Int32 for the length field, which relates to my first question. I tried to use cereal for lazy decoding. This didn't work because o <- take won't return a lazy bytestring. Is there any way to take those X bytes lazy? Is it even relevant whether its lazy or not...?

In a second step I tried to decode with binary library which seems to work fine. But now I'm facing the problem with error handling since decode returns Either String a.

lengthParser :: Parser Length lengthParser = do l <- take 4 case (decode l) of Left l -> return $ ? Right r -> return $ r offsetParser :: Parser Offset offsetParser = do o <- take 8 let offset = decode o case offset of Left l -> return ? Right r -> return r

What would be the appropriate way to handle errors in this scenario? Would it be appropriate to create some type, lets say Either String Offset, and pass this one layer up to my entryParser. Then again distinguish Left/Right and so forth? This doesn't seems really intuitive to me...

So any hints are appreciated a lot :)

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

Ken T Takusagawa: [zyxbhqnd] Defining monads with do notation

Planet Haskell - Wed, 03/25/2015 - 2:33am

If one happens to be most comfortable with "do" notation for monads ("What are monads? They are the things for which "do" notation works well."), so monads implicitly being defined in terms of bind (>>=) and return, here are the definitions of map and join, the "other" way of defining monads:

join :: (Monad m) => m (m a) -> m a;
join xs = do { x <- xs ; x }

map :: (Monad m) => (a -> b) -> m a -> m b;
map f xs = do { x <- xs ; return $ f x }

map is identical to liftM and slightly narrower than fmap which requires only the Functor typeclass instead of Monad.  This redundancy is one of the motivations for the AMP proposal.  Incidentally, map (as defined above) would work as well as the famous Prelude map function which operates only on lists, because a list is a Monad (and a Functor).

Just for completeness, here is bind defined in do notation:

(>>=) :: (Monad m) => m a -> (a -> m b) -> m b;
(>>=) xs f = do { x <- xs ; f x }

I sometimes like explicitly using the bind operator instead of do notation because the syntax, specifying xs then f, lines up well with the thought process "first prepare the input xs to a function, then call the function f on it".  It also works well for longer chains.  For example, the expression xs >>= f >>= g >>= h is equivalent to

do {
x <- xs;
y <- f x;
z <- g y;
h z;
}

but not having to name the intermediate results.

Inspired by the tutorial Monads as containers.

Update: added type signature for (>>=).

Categories: Offsite Blogs

cabal test and tests that overlap in covarage

haskell-cafe - Wed, 03/25/2015 - 2:32am
is this a cabal error or hpc error? i see this when running 'cabal test' with tests that overlap in coverage 5 of 5 test suites (5 of 5 test cases) passed. hpc: found 2 instances of RBM.List in ["./.hpc","./dist/hpc/vanilla/mix/proto","./dist/hpc/vanilla/mix/perf-repa-RBM","./dist/hpc/vanilla/mix/test-repa-RBM","./dist/hpc/vanilla/mix/perf-list-RBM","./dist/hpc/vanilla/mix/test-list-RBM","./dist/hpc/vanilla/mix/rbm-0.0"] Thanks, Anatoly
Categories: Offsite Discussion

GHC Weekly News - 2015/03/24

Haskell on Reddit - Wed, 03/25/2015 - 1:23am
Categories: Incoming News

CFP: Erlang Workshop 2015

General haskell list - Tue, 03/24/2015 - 10:26pm
Hello all, Please find below the Call for Papers for the Fourteenth ACM SIGPLAN Erlang Workshop. Apologies for any duplicates you may receive. CALL FOR PAPERS =============== Fourteenth ACM SIGPLAN Erlang Workshop ----------------------------------------------------------- Vancouver, Canada, September 4, 2015 Satellite event of the 20th ACM SIGPLAN International Conference on Functional Programming (ICFP 2015) August 30 - September 5, 2015 _http://www.erlang.org/workshop/2015/ErlangWorkshop2015.html_ Erlang is a concurrent, distributed functional programming language aimed at systems with requirements of massive concurrency, soft real time response, fault tolerance, and high availability. It has been available as open source for 16 years, creating a community that actively contributes to its already existing rich set of libraries and applications. Originally created for telecom applications, its usage has spread to other domains including e-commerce, banking, databases, and computer telephony and mes
Categories: Incoming News

The GHC Team: GHC Weekly News - 2015/03/24

Planet Haskell - Tue, 03/24/2015 - 8:20pm

Hi *,

It's time for the GHC weekly news. We've had an absence of the last one, mostly due to a lot of hustle to try and get 7.10 out the door (more on that shortly throughout this post). But now we're back and everything seems to be taken care of.

This week, in the wake of the GHC 7.10 release (which is occuring EOD, hopefully), GHC HQ met up for a brief chat and caught up:

  • This week GHC HQ met for only a very short time to discuss the pending release - it looks like all the blocking bugs have been fixed, and we've got everything triaged appropriately. You'll hopefully see the 7.10 announcement shortly after reading this.

We've also had small amounts of list activity (the past 6-8 weeks have been very, very quiet it seems):

  • Yitzchak Gale revived a thread he started a while back, which puttered out: bootstrapping GHC 7.8 with GHC 7.10. The long and short of it is, it should just about work - although we still haven't committed to this policy, it looks like Yitz and some others are quite adamant about it. ​https://mail.haskell.org/pipermail/ghc-devs/2015-March/008531.html

Some noteworthy commits that went into ghc.git in the past two weeks include:

Closed tickets this past week include: #9122, #10099, #10081, #9886, #9722, #9619, #9920, #9691, #8976, #9873, #9541, #9619, #9799, #9823, #10156, #1820, #6079, #9056, #9963, #10164, #10138, #10166, #10115, #9921, #9873, #9956, #9609, #7191, #10165, #10011, #8379, #10177, #9261, #10176, #10151, #9839, #8078, #8727, #9849, #10146, #9194, #10158, #7788, #9554, #8550, #10079, #10139, #10180, #10181, #10170, #10186, #10038, #10164, and #8976.

Categories: Offsite Blogs

Haskell-related PhD Studentship at Kent

haskell-cafe - Tue, 03/24/2015 - 5:12pm
Dear Haskellers, I am seeking a PhD student on a Haskell-related project: http://www.cs.kent.ac.uk/research/studyingforaphd/phd-wang.html This would be a good opportunity for someone who is interested in applying Haskell ideas to real problems. The funding covers maintenance, EU student fees and research related expenses. But non-EU students are welcome to apply too. For Sep 2015 starting, the application deadline is 17 April 2015. If you are interested, please contact me at m.w.wang< at >kent.ac.uk<mailto:m.w.wang< at >kent.ac.uk>. Best wishes, Meng — Dr Meng Wang School of Computing University of Kent http://www.cs.kent.ac.uk/people/staff/mw516/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

remoteok.io

del.icio.us/haskell - Tue, 03/24/2015 - 4:11pm
Categories: Offsite Blogs

remoteok.io

del.icio.us/haskell - Tue, 03/24/2015 - 4:11pm
Categories: Offsite Blogs

A beginner's troubles

Haskell on Reddit - Tue, 03/24/2015 - 4:07pm

Hi, so I'm a little embarrassed to say this, but I'm stuck on a problem that none of the books or video tutorials that I've seen has considered important enough to explain. So I should preface by saying that this is my first programming language. I thought I could hop in by reading some research along with the documentation and wrapping my head around some of the underlying math, but the biggest challenge has been implementation. Since most haskell programmers come from imperative backgrounds, I think they get the bulk of what they need to do on the command line and in the program files. I don't. I have an abstract understanding of the language, which I'm seeing has very little practical value with getting started.

So, here it goes:

I downloaded ghci, and I load it by going to my program files, and double clicking the ghci 7.8.3 application. It loads, and I'm on the command prompt. My problem is that though I can add numbers and things like that, I can't seem how to load 'scripts' or how to save them or where to save them to. My guess so far is that I save them into 'bin'. I'm not sure how I would have to preface these files. Do I put 'main' in a text file and save it as .hs into the bin folder?

To compound my confusion, I downloaded the Eclipse IDE (eclipseFP), and so far have everything other than hoogle, though I'm still trying to figure out how eclipse 'connects' with ghc. I did this because I could not figure out how to install cabal or hoogle just from the command line. I read that this was one of the things I needed to do in order to start. Can anyone clarify these super basic things for me?

The loading of files, the idea of a 'script', these are the things racking my brain. Please help!

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