News aggregator

.a files not found

haskell-cafe - Sat, 05/30/2015 - 10:39am
L.S., I get messages about .a files not being found, when I try to install package data-default-instances-base, data-default-instances-containers, data-default-instances-dlist or data-default-instances-old-locale. How can I solve this? I am using GHC 7.10.1 on Windows. Sample output: C:\X\data-default-instances-old-locale-0.0.1> cabal install Resolving dependencies... Configuring data-default-instances-old-locale-0.0.1... Building data-default-instances-old-locale-0.0.1... Failed to install data-default-instances-old-locale-0.0.1 Build log ( C:\Users\X\AppData\Roaming\cabal\logs\data-default-instances-old-locale-0.0.1.log ): Building data-default-instances-old-locale-0.0.1... Preprocessing library data-default-instances-old-locale-0.0.1... [1 of 1] Compiling Data.Default.Instances.OldLocale ( Data\Default\Instances\OldLocale.hs, dist\build\Data\Default\Instances\OldLocale.o ) C:\Programs\Haskell\MinGHC-7.10.1\ghc-7.10.1\mingw\bin\ar.exe: dist\build\libHSdata-default-instances-old-locale-0.0.1-6jcjjaR25tK
Categories: Offsite Discussion

IHaskell Online: Help Choose Demo Code Snippets!

Haskell on Reddit - Sat, 05/30/2015 - 9:45am

Hey /r/haskell,

We recently got IHaskell usable online via We've now added a demo notebook, which you can access by going to and clicking on "Welcome to Haskell".

This notebook can be used as a live, interactive demo of Haskell, and so it would be great if it could demonstrate to people the basics of Haskell and some of the cool things it can do, and how it can be used to express type system invariants and lead to cleaner and readable code.

What code snippets would you like to see on the Welcome to Haskell notebook on I've put up two short ones using infinite lists and finding primes, and also a small demo of Parsec, which was for me the "whoa" moment of Haskell. (Not all packages would be available because we are disk-space limited on the Docker images for the tmpnb instance, but we can change the packages depending on what code snippets people suggest.)

All suggestions welcome! (And sorry for so many IHaskell-related stories lately – figured this might be something the greater Haskell community would want to have input on, as it may end up as an intro to IHaskell for many people.)

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

2 Project Euler-inspired Python constructs, to Haskell?

Haskell on Reddit - Sat, 05/30/2015 - 9:06am

Because of Haskell's mathematical roots and all, I thought it'd be a killer tool to review a lot of my Project Euler solutions. There are two incredibly handy python constructions that I've used to great success, and I'm having a lot of trouble writing anything remotely like them in Haskell without diving into what feels like remote corners of its ecosystem, or typing mountains of text.

The first is a prime sieve:

def primes_upto(k): ''' >>> list(primes_upto(20)) [2, 3, 5, 7, 11, 13, 17, 19] ''' is_prime = [True] * int(k+1) is_prime[0] = is_prime[1] = False for n in (n for n, prime in enumerate(is_prime) if prime): yield n if n**2 > k: continue is_prime[2*n::n] = [False] * int(k/n-1)

Plain python, short, concise. Up to 1E6 in an instant. I understand that Haskell not having state makes it difficult, but it honestly seems like the way to go for handling prime number problems in Haskell on PE is to just read from a python-generated file. There's a whole page on the Haskell wiki dedicated to prime number generation methods, about wheels and such, but I wasn't able to precise what a PE person would use.

The other one has to do with the fact that "function purity" seems like it would lend itself brilliantly to a little bit of cache-ing. However, instead of there being some kind of incredibly compact way to tell Haskell "hey, cache this function", you have to build a whole bunch of structures to allow it. I know, cache means altering state, and purity doesn't allow this to just happen, but is there no concise way of simulating the following?

def collatz_chain_length(n, cache={1:[1]}): ''' >>> collatz_chain_length(13) [13, 40, 20, 10, 5, 16, 8, 4, 2, 1] ''' m = 3*n+1 if n%2 else n//2 if n not in cache: cache[n] = [n] + collatz_chain_length(m) return cache[n] submitted by fatpollo
[link] [16 comments]
Categories: Incoming News

Why is vector sort slower than list sort?

haskell-cafe - Sat, 05/30/2015 - 6:24am
From places like and I'm led to believe that sorting mutable vectors is faster than sorting lists. However, when running on my own computer, I'm seeing the opposite effect. What's wrong with what I'm doing, or am I misunderstanding something? What's the fastest way to sort? Here's the code: Sort0.hs (List version) import Control.Monad import System.Random import qualified Data.Vector as IV import qualified Data.Vector.Mutable as MV import qualified Data.Vector.Generic as V import qualified Data.Vector.Algorithms.Intro as VA import qualified Data.List as L randList :: IO [Int] randList = sequence $ replicate 1000000 (randomIO :: IO Int) main = do v <- randList print $ L.sort v Here's Sort1.hs import Control.Monad import System.Random import qualified Data.Vector as IV import qualified Data.Vector.Mutable as MV
Categories: Offsite Discussion

What I found inconvenient in Haskell

Haskell on Reddit - Sat, 05/30/2015 - 2:31am

Following the post What are the inconsistence and the inconveniency, which seems a bit cluttered. I'm starting this new one which what I found inconvenient in Haskell and would like people opinions

  • Import is a pain. You often end up writing more import than code itself. At the moment, you can import everything you need and reexport it, but it loses the qualification. If you could export qualified modules , you should be able to write an module equivalent to a list of qualified imports

  • the "if it compiles it works" fallacy. It's just a myth and trying to sell Haskell with a false argument is not good IMHO.

  • debugging is not great. I would be happy with just a tool help doing equational reasoning.

  • I'm shocked that the community thinks using "id" or "indexes" to represent mutable graphs is acceptable even though it's reinventing pointers with the same level of unsafety

  • Num should be an instance of Monoid (using (+)). I'm not buying the argument "there are 2 possibles instances, therefore we don't want to chose". List have 2 possible instances of applicative and that doesn't stop List to be an applicative. Then (+) is the natural moniod instance for many reasons. Monoid can be seen as weak Group. Num are a group under (+) but not under ( * ). Also most of the time, Num are used to represent physical quantities (with units, as 1 metre, 2 potatoes, etc ...). Such quantities have only one possible instance for Monoid. Last, for the few people which really need the (Num,(* )), they can still use Product or better use logs.

submitted by maxigit
[link] [134 comments]
Categories: Incoming News

A quasi quoter for UTCTime time literals.

Haskell on Reddit - Fri, 05/29/2015 - 10:53pm

Sometimes hard-coding a time is not the worst idea ever. I've had to do this enough times now to warrant this:

This is how it looks:

>>> [utcIso8601| 2048-12-01 |] :: UTCTime 2048-12-01 00:00:00 UTC >>> [utcIso8601ms| 2099-01-01T00:00:00.42324 |] 2099-01-01 00:00:00.42324 UTC

I suspect there may be some breakage around 7.10 with locales, but I'll cross that bridge when I get there. Docs haven't built yet but the code above is all you really need to know.

submitted by christian-marie
[link] [3 comments]
Categories: Incoming News

Annoucing Eddie 1.0.0

haskell-cafe - Fri, 05/29/2015 - 10:25pm
Eddie is a tool to let you use Haskell code in shell scripts, in a manner similar to the way awk and other scripting languages can be used. The jump to 1.0.0 isn't because it's finished, but because this is a rewrite from the ground up to incorporate more modern Haskell features (the old version was my first non-trivial Haskell program), resulting in changes to various behaviors as well as some option tweaks. Most notably, it no longer uses [Char] for everything. In text mode, it uses Text, with options to specify both input and output encodings. In binary mode, it uses ByteString, with an option to set the output back to Text so you can generate summaries as opposed to simply filter. To make using Text and ByteString sane, it also uses ClassyPrelude instead of Prelude + Data.Char & Data.List so your Haskell list habits work - at least mostly. See in the source or ChangeLog in the wiki for detailed changes. Otherwise, the manual page is available on the web site. _____________________________
Categories: Offsite Discussion

ANNOUNCE: Haskell Communities and Activities Report(28th ed., May 2015)

haskell-cafe - Fri, 05/29/2015 - 9:41pm
On behalf of all the contributors, we are pleased to announce that the Haskell Communities and Activities Report (28th edition, May 2014) is now available, in PDF and HTML formats: Many thanks go to all the people that contributed to this report, both directly, by sending in descriptions, and indirectly, by doing all the interesting things that are reported. We hope you will find it as interesting a read as we did. If you have not encountered the Haskell Communities and Activities Reports before, you may like to know that the first of these reports was published in November 2001. Their goal is to improve the communication between the increasingly diverse groups, projects, and individuals working on, with, or inspired by Haskell. The idea behind these reports is simple: Every six months, a call goes out to all of you enjoying Haskell to contribute brief summaries o
Categories: Offsite Discussion

wren gayle romano: Migrating emails etc

Planet Haskell - Fri, 05/29/2015 - 9:15pm

I've been working on culling a bunch of my old email addresses and unifying my username across the internet. I've mentioned a number of these changes before, but every few months I run into folks who've missed the memo. So, for those who keep up with my blog or follow Haskell Planet, here's the latest rundown:

  • —is dead
  • —is dead
  • —will soon be dead
  • My Perl forwarding address lives—
  • My Haskell forwarding address lives—
  • My current work address is—
  • My personal email at is also lives
Code Hosting & Other User Names
  • My BitBucket username has changed from winterkoninkje to wrengr
  • My GitHub username has changed from winterkoninkje to wrengr
  • My IRC username has changed from koninkje to wrengr

Categories: Offsite Blogs

Felipe Almeida Lessa: Changing NetworkManager route metrics

Planet Haskell - Fri, 05/29/2015 - 8:35pm

If you use NetworkManager with more than one interface, you probably want to control the metric of their routes. Here’s one way you can do it.


I got a PCI Express WiFi card (wlan0) and a USB WiFi dongle (wlan1). On my system, NetworkManager will activate both at the same time. Then it gives metric 600 to the first one to be activated, and 601 to the second one.

What I wanted was to say: hey, NetworkManager, use metric 500 for wlan1 and 600 for wlan0. It doesn’t look like this is supported, though. Also, DuckDuckGo and Google didn’t help me much.

Digging through the nm-settings(5) man page, though, I found the route-metric option.  It’s not ideal because it’s applied to a connection, not to a device.  But it works fine for my use case as each WiFi interface is connected to a different WiFi network.

Step 1: Find out which are your connections

Use the nmcli helper to list your connections:

$ nmcli connection NAME       UUID                                  TYPE             DEVICE Network 1  f0ed603c-f3c3-4acb-b54b-bb857bd9c5b5  802-11-wireless  wlan0        Network 2 2b4b7240-36bd-407a-a3aa-169abb0ce6c4  802-11-wireless  wlan1

As you can see here, each interface is using a different connection.

Step 2: Set the connection’s default route metric

For example, to set the wlan1 interface’s default route metric to 500, just change its connection:

$ nmcli connection modify uuid 2b4b7240-36bd-407a-a3aa-169abb0ce6c4 ipv4.route-metric 500 $ nmcli connection modify uuid 2b4b7240-36bd-407a-a3aa-169abb0ce6c4 ipv6.route-metric 500 $ nmcli connection show uuid 2b4b7240-36bd-407a-a3aa-169abb0ce6c4 | grep route-metric ipv4.route-metric:                      500 ipv6.route-metric:                      500 Step 3: Check that your routing table is correct

NetworkManager should automatically change the route’s metric:

$ ip route default via dev wlan1  proto static  metric 500 default via dev wlan0  proto static  metric 600 dev wlan0  proto kernel  scope link  src  metric 600 dev wlan1  proto kernel  scope link  src  metric 500

If it didn’t, try restarting NetworkManager.

Categories: Offsite Blogs

Haskell Weekly News

haskell-cafe - Fri, 05/29/2015 - 5:40pm
*Top Picks:* - Tony Day, Brisbane-based investment strategist and high-frequency-trading hacker, rides 100% idiomatic Haskell <> into the Single Page (web)-App <> space. How? He spins the GHCJS transpiler on Gabriel Gonzalez's Model-View-Controller library to obtain his own TodoMVC benchmark demo <>. Per GHCJS, the production spans multi-megabytes of javascript. Not to be missed: auto-run, i.e. click the QuickCheck-powered checkbox labeled "Let haskell do the work." Github repo <>. Along the way, he discovers how crippled Javascript is without sum types. As noted on HN <>, "Typos and missing cases represent a very large set of trivial bugs." He believes superior FP features such as sum types makes it "much harder for haskell to
Categories: Offsite Discussion

recursive datakinds

haskell-cafe - Fri, 05/29/2015 - 4:47pm
Hello, If I were trying to do something like creating types like.... what about Cafe2.lhs:23:30: Occurs check: cannot construct the infinite type: b ~ a : b Expected type: MyList b Actual type: MyList (a : b) Relevant bindings include myrecursivelist :: MyList (a : b) (bound at Cafe2.lhs:23:3) In the second argument of 'MyCons', namely 'myrecursivelist' In the expression: MyCons 1 myrecursivelist can I "fix" this somehow? I obviously want the type of myrecursivelist to be MyList '[Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer,.....] Something like a completely nonsensical... MyList (Fix (Integer ': )) P.S. Yes, I barely understand "fix" as a function, let alone a data type. CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediate
Categories: Offsite Discussion

Holden Karau: Learning Spark - now updated for Spark 1.3

Planet Haskell - Fri, 05/29/2015 - 4:30pm
I'm pleased to announce, albeit somewhat late, that the Learning Spark book has been updated for Spark 1.3+, including Spark SQL's DataFrames and . In the process we also fixed a large number of errata issues reported, so please keep reporting issues so we can keep improving.
Categories: Offsite Blogs

LPMR 2015 - Associated events - DEADLINES

General haskell list - Fri, 05/29/2015 - 3:48pm
[apologies for multiple or cross- posting] The LPNMR 2015 Program Committee is evaluating the submitted papers, and notifications of acceptance are expected soon. However, we would like to remember that this year's edition comes along with a very rich set of associated events: 4 Workshops, the ADT 2015 conference, the joint ADT/LPNMR Doctoral Consortium, not to mention the 6th Answer Set Programming Competition. Quite a rich menu, right? Deadlines are approaching for such events, and this is intended as a gentle reminder: * GTTV'15: June 22, 2015 * ALPP 2015: July 15, 2015 * NLPAR 2015: June 22, 2015 * LNMR'15: June 22, 2015 * ADT 2015: time over * Joint LPNMR-ADT Doctoral Consortium: June 1, 2015 * Answer Set Programming Competition ASPCOMP: June 1, 2015 More details can be found here:
Categories: Incoming News