News aggregator

Haskell Weekly News

General haskell list - Wed, 04/01/2015 - 5:18pm
*Top picks:* - Bot attack on Trac <https://mail.haskell.org/pipermail/ghc-devs/2015-March/008557.html> pummels GHC HQ productivity! Do you know a thing or two about hardening web apps? Can you help? - A month ago <http://haskell.1045720.n5.nabble.com/Haskell-Weekly-News-td5766529.html> you read about the absence of a correct operational spec for Core. Christiaan Baaij <http://ghc.haskell.org/trac/ghc/ticket/10121#comment:7> proffers rewriting rules for something "very much like Core" from his 2014 thesis on Digital Circuits in CλaSH, a tool designed for Computer Architecture for Embedded Systems (CAES). The consensus is that they probably also work for GHC Core. - Neil Mitchell reports Unable to load package Win32-2.3.1.0 <https://ghc.haskell.org/trac/ghc/ticket/10165>. The problem? SetWindowLongPtrW exists only on 64-bit. The haskell win32 shim wasn't switching to SetWindowLongW on 32-bit. Darren Grant steps up to offer a fix, which Austin Seipp promptl
Categories: Incoming News

Speed up ghc -O2

haskell-cafe - Wed, 04/01/2015 - 2:30pm
My program reads a xls file and creates a haskell program that does exactly the same as what the xls does. Every cell in the xls is a function and contains 2 lines: the type declaration and 1 line the implementation. The type of a cell is XlsCell. data XlsCell = Reader ExternalCells XlsCellRes data XlsCellRes = XlsCellString String | XlsCellBool Bool | ..... type ExternalCells = Map String XlsCellRes -- search (or set) a value of a cell by its name. The externalCells are for the cells you can change at runtime. The generated program was first 30000 lines. When I compiled it with ghc 7.8.3. -O0 the program worked, but was terribly slow. With -O2 I got: out of memory. With a few trics the generated code is now split up in 2 files 5000 and 10000 lines. I've upgraded to ghc 7.8.4. If I do ghc -O2 the program takes more then 4 hours to compile. The -O2 compilation is essential. The resulting program is much (more then 10x) faster then without -O2. What can I do (changes in the generated code, changes
Categories: Offsite Discussion

Increased memory usage with GHC 7.10.1

glasgow-user - Wed, 04/01/2015 - 1:26pm
Forall hi, I just uprgaded both of my machines to use GHC 7.10.1. I keep sandboxed installations of GHC and this means I had to rebuild Agda and Idris because the binaries built with GHC 7.8.4 were stored inside deactivated 7.8.4 sandbox. Sadly, I had problems building both Agda and Idris due to GHC taking up all of available memory. With Idris the problematic module was Idris.ElabTerm (~2900LOC). The interesting part of the story is that when I do a clean build of Idris GHC consumes all of memory when compiling that module and I have to kill the build. But when I restart the build after killing GHC the module is compiled using a reasonable amount of memory and within reasonable time. With Agda the problematic module is Agda.TypeChecking.Serialise (~2000LOC). The trick with killing the build and restarting it didn't work in this case. I had to compile Agda with GHC 7.8.4 (which works without problems though the mentioned module still requires a lot of memory) and alter my setup so that Agda binar
Categories: Offsite Discussion

Stable location for monomorphic foldr?

libraries list - Wed, 04/01/2015 - 12:14pm
Hi, I just stumbled over a FTP breakage: A RULES with "foldr" on the left hand side would no longer fire, because it would refer to Foldable.foldr, and not the monomorphic foldr. Adding #if MIN_VERSION_base(4,8,0) import Prelude hiding (foldr) import GHC.OldList (foldr) #endif to the file solved the problem for now, but GHC.OldList is supposed to go away eventually, so I believe we need a permanent location for the monomorphic foldr. Or will we simply not get rid of GHC.OldList at all? (One could argue that "foldr" on the left-hand-side of a RULE should work and that this is a GHC bug, though.) Greetings, Joachim
Categories: Offsite Discussion

Haskell - April 1st.

Haskell on Reddit - Wed, 04/01/2015 - 11:41am
Categories: Incoming News

Clifford Beshers: April Fools' Joke Exposes Weakness in Twitter Verification

Planet Haskell - Wed, 04/01/2015 - 11:25am
There was a prank in my Twitter feed today (April 1) that, on top of being very elegant, exposed a subtle loophole in Twitter's verification procedures.  (Here is a screenshot, in case the prank has been removed by now.) Notice the checkmark that indicates a verified account.

The prank involves two soccer players, Jozy Altidore, USMNT striker who was given a red card yesterday for cursing at the referee, and Mike Magee, star of MLS team Chicago Fire, known mischief maker.

Magee swapped the theme on his twitter account to make it look like he was Jozy Altidore and posted the spoof.  Normally, this sort of thing gets rejected easily because of the verification badge. But the badge is there.  I went looking to see how Magee had faked the badge.

He hadn't. Magee is also a celebrity and also has a verified account.  Anyone with a verified account can pretend to be someone else with a verified account, apparently.

So I think if I were Twitter, I would change the name field  for verified accounts to be immutable. Quickly, before Nathan Fillion finds out.



Categories: Offsite Blogs

Specify OS version

haskell-cafe - Wed, 04/01/2015 - 10:40am
Hi Cafe! I have program written in Haskell and Swift that runs on Mac. This program uses some features that was introduced in last version of OS X “Yosemite” 10.10, but some of my users use previous version "Maverics " 10.9. Is there some technique that allows me to extend my cabal file and specify which *version* of os is currently in use and don't load some of modules? AFAIK, Cabal's `conditional` doesn't provide such mechanism, but something like ``` if os(osx) && ver(=10.10) if os(osx) && ver(<=10.9) ``` will be nice. Maybe there is other approach to this problem?I don't want to use `CPP` extension to handle this within code. Thanks -- Best regards, Sergey Bushnyak _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

DSLDI: 3rd Workshop on Domain-Specific Language Designand Implementation (EXTENDED DEADLINE)

General haskell list - Wed, 04/01/2015 - 10:35am
********************************************************************* SECOND CALL FOR TALK PROPOSALS DSLDI 2015 Third Workshop on Domain-Specific Language Design and Implementation July 7, 2015 Prague, Czech Republic Co-located with ECOOP http://2015.ecoop.org/track/dsldi-2015-papers ********************************************************************* EXTENDED Deadline for talk proposals: 9th of April, 2015 If designed and implemented well, domain-specific languages (DSLs) combine the best features of general-purpose programming languages (e.g., performance) with high productivity (e.g., ease of programming). *** Workshop Goal *** The goal of the DSLDI workshop is to bring together researchers and practitioners interested in sharing ideas on how DSLs should be designed, implemented, supported by tools, and applied in realistic application contexts. We are both interested in discovering how already known domains such as graph processing or machine learning can be best supported by DSLs, but also in e
Categories: Incoming News

Binary bloat in 7.10

glasgow-user - Wed, 04/01/2015 - 10:30am
Why do the 7.10 libraries take up so much more space than 7.8? For example, using the same build options and strip --strip-unneeded, 7.8 leaves me with 15M libHSCabal-1.18.1.5.a 17M HSCabal-1.18.1.5.o whereas 7.10 balloons to 23M HSCabal-1.22.2.0-HWT8QvVfJLn2ubvobpycJY.o 53M libHSCabal-1.22.2.0-HWT8QvVfJLn2ubvobpycJY.a -- View this message in context: http://haskell.1045720.n5.nabble.com/Binary-bloat-in-7-10-tp5768067.html Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.
Categories: Offsite Discussion

Proposal: Improving Layout

Haskell on Reddit - Wed, 04/01/2015 - 10:23am

There are many points in the tabs vs. spaces debate.

There are folks who believe that tabs are evil and should be eradicated from all source files, lest wonky editor settings confuse their collaborators.

We've had -fwarn-tabs for a while, but what about the alternatives?

-fwarn-fixed-width

Consider the following example of bad, brittle, style:

foo xs = do a <- bar b <- baz quux a b

This remains blissfully unwarned about by -fwarn-tabs. Yet, if I refactor the code to change the name of the identifier, I have to reindent the entire block!

You can avoid this problem, however, if you always start a layout section on a new line.

We can get a much more stable layout with

foo xs = do a <- bar b <- baz quux a b

Now we can rename foo to our heart's content, and only have to affect a single line.

Moreover, in this example, the debate about what tabstops people should use disappear; this example works with any notion of tabstop: 2, 4, the traditional 8, even elastic!

Layout based on spaces and character widths is problematic for languages like Japanese that have full width (全角) characters, which in a fixed sized font take up two character slots across. GHC remains unaware of these characters and so "counts spaces" wrong when deciding layout. This is bad for internationalization.

But we don't need to go so far afield to realize the benefits!

We all program in fixed width fonts, which are hard on the eye, but easy on the terminal. What if we could free Haskell from the tyranny of fixed width?

Similarly many of us use editor improvements that replace ugly multicharacter glyphs with single characters and restore them to their portable form upon saving the source file. These are similarly affected.

So I propose -fwarn-fixed-width, which would complain if the indentation used for layout depends at all on the visual width of a character or tabstop setting. Code that compiles -fwarn-fixed-width clean can then be safely edited in Notepad using a variable width font, or in emacs or vim with whatever tabstop setting you like!

-fwarn-spaces

If these were the only camps we had to consider, then I think we'd be okay.

What about users who have an even stronger aversion to spaces? Adding -fwarn-spaces would restore symmetry. We have -fwarn-tabs, which simply warns about a tab anywhere in a source file, so we should add -fwarn-spaces for symmetry that similarly complains about a space character anywhere in the source file.

It is even possible to write legal Haskell that passes both -fwarn-spaces and -fwarn-tabs. (Admittedly reading the documentation for such code may be difficult.) Consider the following example of a prefix combinator and of the infix forms of view and over from lens.

module Foo where{ import Data.List; import Data.Functor.Identity; import Control.Applicative; foo::Ord(a)=>[a]->[a]; foo=sort; infixr 8 ^.; x^.l=getConst(l(Const)x); x&f=f(x); infixr 4 %~; l%~f=runIdentity(l(Identity`fmap`f)) }

After all, much of GHC is already written with explicit {;} layout, and we've already removed all the tabs, so perhaps it is time to consider removing all of the spaces as well. An automated source code translator could easily be written to ease the transition to the new language.

This suggests that this warning should be added to -Wall.

-fwarn-multiple-spaces

Sadly, there are those who might complain about the wasteful use of spaces in a space-based layout block like:

foo xs = do a <- bar b <- baz quux a b

Adding -fwarn-multiple-spaces would allow us to ensure that we aren't wasting disk space holding onto multiple, redundant spaces between tokens. This does, admittedly come at the cost of destroying any notion of nested layout without explicit {;}'s, as with -fwarn-spaces above, but a user can always succeed in transforming code to remove such niceties.

-fwarn-whitespace

But the previous example is really abusing the use of a newline as a whitespace character that is neither a space nor a tab.

We can shut this down by adding -fwarn-whitespace, which is less permissive, and disables every character in the unicode "Whitespace" class.

Alas, -fwarn-whitespace comes at the low price of being unable to write imports, new data types, fixity statements, or issue any {-# LANGUAGE #-} pragmas. Fortunately, with the Foldable/Traversable proposal bringing everything we want into Prelude, there is no reason why anybody would want to do any of that other stuff anyways.

On a positive note, code written in this style can't use f a b for function application. Users are forced into f(a,b) or f(a)(b) like they are in more civilized languages.

Let's consider the positive effect on coding style and readability:

Consider Jeremy Gibbons' spigot algorithm for producing a stream of the digits of pi, which usually sprawls wastefully over four lines:

pi = g(1,0,1,1,3,3) where g(q,r,t,k,n,l) = if 4*q+r-t<n*t then n:g(10*q,10*(r-n*t),t,k,div(10*(3*q+r))t-10*n,l) else g(q*k,(2*q+r)*l,t*l,k+1,div(q*(7*k+2)+r*l)(t*l),l+2)

With -fwarn-whitespace, we are encouraged to optimize our encoding down to:

ghci> let(q,r,t,k,n)%l|4*q+r-t<n*t=n:(10*q,10*(r-n*t),t,k,div(10*(3*q+r))t-10*n)%l|z<-t*l=(q*k,(2*q+r)*l,z,k+1,div(q*(7*k+2)+r*l)z)%(l+2)in(1,0,1,1,3)%3>>=show

But we can go further, if we care less about asymptotics and more about code density and replace Jeremy's algorithm with the more succinct:

ghci> '3':let n/m=(take(n).drop(n).show$4*sum[2%i+3%i|i<-[1,3..m],let(a)%i=div(1000^n)(a^i*i)*(-1)^(i`div`2)])++(2*n)/(2*m)in(1/9)

We can construct similarly dense -fwarn-whitespace-clean encodings for all of the digits of e:

ghci> let(!)=div;f(n)=1:1:n:f(n+2);w@(x:y)%v@[a,b,c,d]|t<-a!c,all(>0)v&&t==b!d=t:w%[10*(a-c*t),10*(b-d*t),c,d]|0<1=y%[x*a+b,a,x*c+d,c]in(2:1:2:f(4))%[1,0,0,1]>>=show Other Concerns

Writing code that complies with these warnings necessitates revisiting many of the style guidelines folks have come to associate with Haskell code. Alas, such code is at odds with other warnings we might consider, such as warnings for when your code exceeds the width of the vt100 terminal I had available to me in back in 80s.

Perhaps we can draw insight from the thriving APL, J, and Q communities for how to proceed.

On any other day of the year, you may want to stop reading this proposal after the first section and consider it seriously.

Thank you for your consideration,

-Edward Kmett

submitted by edwardkmett
[link] [30 comments]
Categories: Incoming News

Journal of Functional Programming - Call for PhDAbstracts

haskell-cafe - Wed, 04/01/2015 - 9:23am
============================================================ CALL FOR PHD ABSTRACTS Journal of Functional Programming Deadline: 30th April 2015 http://tinyurl.com/jfp-phd-abstracts ============================================================ PREAMBLE: Many students complete PhDs in functional programming each year, but there is currently no common location in which to promote and advertise the resulting work. The Journal of Functional Programming would like to change that! As a service to the community, JFP recently launched a new feature, in the form of a regular publication of abstracts from PhD dissertations that were completed during the previous year. The abstracts are made freely available on the JFP website, i.e. not behind any paywall, and do not require any transfer for copyright, merely a license from the author. Please submit dissertation abstracts according to the instructions below. A dissertation is eligible if parts of it have or could have appeared in JFP, that is, if it is in the
Categories: Offsite Discussion

Journal of Functional Programming - Call for PhD Abstracts

General haskell list - Wed, 04/01/2015 - 9:22am
============================================================ CALL FOR PHD ABSTRACTS Journal of Functional Programming Deadline: 30th April 2015 http://tinyurl.com/jfp-phd-abstracts ============================================================ PREAMBLE: Many students complete PhDs in functional programming each year, but there is currently no common location in which to promote and advertise the resulting work. The Journal of Functional Programming would like to change that! As a service to the community, JFP recently launched a new feature, in the form of a regular publication of abstracts from PhD dissertations that were completed during the previous year. The abstracts are made freely available on the JFP website, i.e. not behind any paywall, and do not require any transfer for copyright, merely a license from the author. Please submit dissertation abstracts according to the instructions below. A dissertation is eligible if parts of it have or could have appeared in JFP, that is, if it is in the
Categories: Incoming News

ANNOUNCE: Parsed 0.0.1

haskell-cafe - Wed, 04/01/2015 - 8:49am
I'm pleased to announce the first release of the Parsed library (pronounced par-séd). Parsed is a reimplementation of Haskell's excellent Parsec library in the Unix shell. In particular, the Unix pipe operator | corresponds exactly to Haskell's Applicative bind *>. Here's a quick example to get a feel for the syntax. The following bash one liner creates a parser for matching balanced parenthesis: ``` parens() { choice "$1" "match '(' | parens \"$1\" | match ')'"; } ``` For more detailed examples and implementation notes, please see the Parsed paper accepted at SIGBOVIK2015: https://github.com/mikeizbicki/parsed/raw/master/sigbovik2015/paper.pdf You can download Parsed from its github page at: https://github.com/mikeizbicki/parsed
Categories: Offsite Discussion

Functor is now a superclass of Monad in GHC HEAD

Haskell on Reddit - Wed, 04/01/2015 - 7:55am

Happy April, everyone

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