News aggregator

www.jdon.com

del.icio.us/haskell - Fri, 11/07/2014 - 12:45am
Categories: Offsite Blogs

why is haddock so slow

haskell-cafe - Thu, 11/06/2014 - 4:40pm
I have a larg-ish project (800 modules) and these ghc compilation times: cabal install : 19 min cabal install --disable-doc : 13 min the compilation includes the profiling build. That is, running haddock takes the same 6 minutes as running the compiler (with optimization) I also built with "optimization: False library-profiling: False" and this takes 3 min. I understand that haddockification goes via the compiler's front-end to resolve names and infer types. This takes 3 min (as the non-optimizing compiler run shows). What does haddock do in the other 3 min? What could I do to help analyze this? - J.W. (ghc-7.8.3, haddock 2.15.0, rotating disk (not SSD), Fedora 20, x86_64)
Categories: Offsite Discussion

Question about the PVP regarding changing A.B when no entities are removed/changed

libraries list - Thu, 11/06/2014 - 1:06pm
Hello all, The PVP <https://www.haskell.org/haskellwiki/Package_versioning_policy> seems to allow changing the A.B version numbers in a package even when no entities are removed/changed; the phrasing is (my emphasis): if only new bindings, types, classes, non-orphan instances or modules (but However, it seems to require changing the C nonetheless: but the new C *must* be greater than the old C As an example, I (mistakenly) released generic-deriving-1.7.0 <https://hackage.haskell.org/package/generic-deriving-1.7.0> after having added one function to it, bumping it from 1.6.3. If my interpretation of the PVP is correct, this change didn't follow the PVP only because I did not increase the C. Had I named it 1.7.4, it would have followed the PVP. (Oddly enough, 0.5.4 would have followed the PVP too!) I think this is a bit odd. Shouldn't we either: 1) Require that A.B remain the same when no entities are removed/changed, or 2) Only require the C to be greater if the A.B remained the same? Thanks, Pedro
Categories: Offsite Discussion

Help in improvement (new to Haskell)

Haskell on Reddit - Thu, 11/06/2014 - 10:27am

Hi,

I am trying to solve this problem from http://www.interviewcake.com in Haskell.

Write a function get_products_of_all_ints_except_at_index() that takes an array of integers and returns an array of the products.

eg. [1,7,3,4] -> [7*3*4, 1*3*4, 1*7*4, 1*7*3].

Please critique my answer:

productsExceptCurrent xs = take (length xs) $ map (productExceptCurrent) zips) [0..] where zips = zip xs [0..] productExceptCurrent xs n = foldr (\(x,y) acc -> if (y /= n) then acc * x else acc) 1 xs

How do I improve my Haskell?

The additional challenge is to make the algorithm work in O(n) time and O(n) space. How do I go about trying to solve that in Haskell?

Thanks, CraniumRat.

submitted by craniumrat
[link] [28 comments]
Categories: Incoming News

Leon P Smith: A Brief History of Timekeeping, Part 1: Dates on the Western Calendars

Planet Haskell - Thu, 11/06/2014 - 4:49am

Time is simple and well understood, right? Well, in a physical sense, it’s fairly well understood, but not at all simple. Cutting edge research into atomic clock technology promises an uncertainty of about a second over an interval of several billion years. This is plenty accurate enough to expose the minuscule relativistic effects of simply repositioning the clock. In fairly short order, differences of fractions of a picosecond can be detected, caused by the fact that time passes at imperceptibly different speeds depending on motion and the small changes in the local gravity field.

But the topic of these posts is the political vagaries of time, not the physical. The basic concept of time (modulo relativity) is something intuitively understood by almost all human beings, and human cultures have been accurately counting the days for thousands of years. So if understanding fractions of a picosecond is difficult, at least dates should be easy, right?

Unfortunately, not so much. Although the Western Calendar has become the de facto and de jure standard over most the world, mapping a Western date to a precise day has some complicated and even ambiguous edge cases.

Julius Caesar introduced the Julian Calendar to the Roman Republic around January 1, 45 BC, in part to help resolve some political problems created by the ancient Roman Calendar. A bit over a year later, on March 15, 44 BC, Julius Caesar was assassinated, motivated in part by some of the political problems the older calendar contributed to.

One might ask, exactly how many days have passed since Caesar was assassinated until the time you are reading this? Certainly, if this question can be answered correctly, arriving at the answer is a bit more subtle than most people realize.

The Julian Calendar was essentially version 1.0 of the Western Calendar, and it’s initial deployment had a few teething problems. There was a bit of confusion surrounding what it meant to have a leap day "every fourth year", and as a result leap days occurred every third year until the error was noticed and corrected by Augustus Caesar and his advisers nearly 40 years later. All leap years were suspended for 12 years, to be resumed at the proper interval once the error was corrected.

We don’t know exactly when those earliest leap years occurred. It does seem as though there is a single probable answer in the case of Caesar’s assassination, as both of the unfalsified candidate solutions for the early leap years lead to the same answer. However, there are many dates over the subsequent decades that could easily refer to one of two days. In any case, sometime around 1 BC to 4 AD, the Julian calendar stabilized, and for nearly 1600 years afterwards, there is an unambiguous mapping of historical dates to days.

However, the average length of a Julian year was longer than the length of the solar year. Over the next 1500 years the dates on the Julian Calendar drifted noticeably out of sync with the solar year, with the spring equinox (as determined by actual astronomical observations) coming some 10 days too early.

In February 1582, Pope Gregory XIII instituted the Gregorian Calendar. Leap years would come every fourth year, as before, but now leap years would be skipped every 100 years, except every 400 years. Also, the new calendar would skip 10 days in order to bring it back in sync with the solar year, with 1582-10-04 followed by 1582-10-15.

And, if that was the entire story, it wouldn’t be so bad, but unfortunately this reform ushered in several hundred years of ambiguity and confusion due to its uneven adoption. This reform was immediately adopted by the Catholic Church, the Papal States and many Catholic nations, with other Catholic nations moving to the Gregorian Calendar soon afterwards. However, the Gregorian Calendar was resisted by most Protestant and Orthodox nations. For example, Great Britain and her colonies held out until 1752,1 and Russia and Greece held out until 1918 and 1923 respectively, shortly after armed revolutions forced a change of government in those countries.

Then you have the case of the Swedish Calendar, which is notable for it’s particularly convoluted, mishandled, and then aborted transition from the Julian to the Gregorian calendars which resulted in a February 30, 1712. Also, in a few locales, including Switzerland and the Czech Republic, some people were using the Julian calendar at the same time others were using the Gregorian calendar.

Thus, accurately identifying a date after 1582 coming from original sources, or any historical date coming from modern sources, can be complicated or even impossible, depending on the precise context (or lack thereof) surrounding the date and its source.

Most dates in modern history books remain as they were originally observed, but there are a few exceptions. For example, the date of George Washington’s birth is observed as 1732-02-22 (Gregorian), even though the American colonies were using the Julian calendar at the time. On the day that Washington was born, the date was actually 1732-02-11 (Julian).

As encouraged by the ISO 8601:2004 standard, computer software often uses the proleptic Gregorian calendar for historical dates, extending the Gregorian calendar backwards in time before its introduction and using it for all date calculations. This includes PostgreSQL’s built-in time types. Glasgow Haskell’s time package supports both the proleptic Julian and Gregorian calendars, though defaults to the Gregorian Calendar.

The good news is that as time marched on, things have gotten better. Driven largely by faster methods of communication and transportation, we’ve gone from the typical context-dependence of dates down to the typical context-dependence of a dozen seconds or so. Even ignoring context, we are often more limited by the accuracy of a typical clock, and technologies such as GPS and NTP are often available to help keep them in reasonable agreement with atomic time standards.

In the upcoming posts of this two or three part series, we’ll look at the process of reducing this ambiguity, as well as local time, time zones, and how PostgreSQL’s nearly universally misunderstood timestamp with time zone type actually works.

  1. Users with access to a unix machine may be amused by the output of cal 9 1752, and differences in various man pages for cal and ncal can be informative, take for example these two.


Categories: Offsite Blogs

Proposal: add liftA4 and liftA5 to match liftM4 and liftM5

libraries list - Thu, 11/06/2014 - 4:24am
Since Applicative is supposed to be important now, I figure we should get these in. _______________________________________________ Libraries mailing list Libraries< at >haskell.org http://www.haskell.org/mailman/listinfo/libraries
Categories: Offsite Discussion

Women in Haskell

Haskell on Reddit - Thu, 11/06/2014 - 3:12am

Gender imbalance in the Haskell community seems much worse than in other communities: I was in this year's ZuriHac and HacBerlin, and I believe that neither had any women participating (and ZuriHac, for instance, had around 100 participants). I was wondering if there were already concerted efforts to try to ameliorate this situation, and ways to contribute to them.

Alternatively, what do people think such a project should look like?

submitted by jkarni
[link] [207 comments]
Categories: Incoming News

Annotations: status and documentation

glasgow-user - Wed, 11/05/2014 - 10:21pm
I would like to be able to retrieve user-supplied annotations in Template Haskell. The 7.8 user manual doesn't mention this ability. However, I see this Trac page: https://ghc.haskell.org/trac/ghc/wiki/TemplateHaskell/Annotations Where it appears that this feature may exist in 7.8. I will gladly tinker with annotations and update the user manual if someone will help me understand what the situation is. On a related note, it looks like this patch pointed to from the Wiki page for annotations got ignored. Should i submit it to phabricator? https://ghc.haskell.org/trac/ghc/ticket/8460 Thanks, Greg Weber _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Categories: Offsite Discussion

Quick Reminder to be Courteous

Haskell on Reddit - Wed, 11/05/2014 - 8:46pm

I don’t want to publicly shame anyone so I won’t link to screenshots of the specific thread I’m talking about, but I saw a heated haskell-related argument on twitter this afternoon that I feel casts a negative light on the haskell community.

The overwhelming majority of haskell enthusiasts and professionals on /r/haskell, the #haskell freenode channel, and twitter are extremely helpful, well-mannered, and kind. Unfortunately I’ve seen two kinds of posts crop up more frequently (particularly on twitter):

1) Posts that put people down who have criticisms about haskell
2) Posts that promote haskell in a way that is condescending and arrogant

It’s great that we have so many passionate people in this community, but posting snarky 140 character snippets on twitter about how our language is better than yours or to claim that “anyone who doesn’t value <purity|static typing|other FP feature> doesn’t care about code quality and correctness” is obnoxious and hurts the cause. There is no One True Waytm to write code, Haskell doesn’t need to be aggressively sold to other programmers, and we don’t need to flame people who disagree with us about its merits and utility.

I might be preaching to the choir here, and if /r/haskell is not the appropriate venue for such a discussion I apologize. I have admired this community for a long time and want it to continue to be seen as a group of respectful and open-minded individuals.

submitted by haskell_throwaway
[link] [39 comments]
Categories: Incoming News

Haskell Lectures

Haskell on Reddit - Wed, 11/05/2014 - 8:01pm
Categories: Incoming News

addCatch in conduit

haskell-cafe - Wed, 11/05/2014 - 6:44pm
In getting the dtd library to compile with recent versions of conduit (yes, I know that it's deprecated and Michael longer supports it, but we still need it), we came across the following bit of code: -- (snip) -- CI.ConduitM $ addCatch $ CI.unConduitM src0 where -- (snip) -- addCatch :: (MonadThrow m, MonadBaseControl IO m) => CI.Pipe l i o u m r -> CI.Pipe l i o u m r addCatch (CI.HaveOutput src close x) = CI.HaveOutput (addCatch src) (addCatch' close) x addCatch (CI.NeedInput p c) = CI.NeedInput (addCatch . p) (addCatch . c) addCatch (CI.Done r) = CI.Done r addCatch (CI.PipeM msrc) = CI.PipeM (addCatch' $ liftM addCatch msrc) addCatch (CI.Leftover p i) = CI.Leftover (addCatch p) i addCatch' m = m `Lifted.catch` throw rr We adapted it to the new ConduitM type simply by changing the first line to: CI.ConduitM $ addCatch . CI.unConduitM src0 Not bad, a diff of exactly one character. It compiles and seems to work. Does this sound rea
Categories: Offsite Discussion

asum really needs to go into the Foldable class (or something)

libraries list - Wed, 11/05/2014 - 6:42pm
The current definition is "biased", using foldr and <|> instead of foldMap and the new Alt. This is a bit awkward in the post-BBP world, but we also don't want to just debias it across the board, because if the Foldable is holding lists, the debiased version will be very bad. More generally, there are a number of Foldable members that are very awkward, pleading for MPTC, because the sane implementations depend on both the container type and the element type. I know we're pushing right up against the deadline for 7.10.1, but the current situation is making me very nervous. David _______________________________________________ Libraries mailing list Libraries< at >haskell.org http://www.haskell.org/mailman/listinfo/libraries
Categories: Offsite Discussion