News aggregator

Christoph Breitkopf: Weigh your Haskell code

Planet Haskell - Thu, 06/02/2016 - 7:44am
Chris Done released the wonderful weigh library to check memory use much like criterion enables you to check speed. His blog post contains a convincing example how looking at the allocations can point you to major speedups, making me eager to check IntervalMap for such problems.
Implementing the first alloc benchmark was straightforward. It took me only a few minutes to produce some comparisons between Data.Set and IntervalSet:
Case Bytes GCs Check Data.Set fromList 1000 440,496 0 OK IntervalSet fromList 1000 2,643,136 1 OK Data.Set fromAscList 989 126,144 0 OK IntervalSet fromAscList 989 224,688 0 OK Data.Set fromDistinctAscList 989 71,816 0 OK IntervalSet fromDistinctAscList 989 163,440 0 OK Data.Set mapMonotonic id 989 39,560 0 OK IntervalSet mapMonotonic id 989 159,520 0 OK This did not look exactly good. My feeling was that IntervalSet should use more memory, but not that much more. Both use node-oriented binary tree data structures. The nodes in IntervalSet have one more field for the interval search information, but that should be at most a 25% difference, not a factor of 4.
The simplest of these functions happens to be mapMonotonic. It just maps a function over the values, keeping the tree structure unchanged. So, when calling it with the id function, we would expect it to allocate one new node per value in the set, and nothing else. Nodes in Data.Set have 4 fields, and should take 40 bytes on a 64-bit machine. So mapMonotonic id on a size 1000 set should allocate 40,000 bytes, plus maybe some padding and a little general overhead. There are 989 unique values in the test data, so the allocation by Data.Set is perfect: 39,560 = 989×40 bytes. IntervalSet nodes have one more field, giving 48 bytes per node, but it allocates about 160,000 instead of the expected 47,472 bytes.
Let's look at the implementation:
mapMonotonic _ Nil = Nil mapMonotonic f (Node c k _ l r) = mNode c (f k) (mapMonotonic f l) (mapMonotonic f r) The mNode function is just the Node constructor augmented with the computation of the interval search information.
In Haskell, one possibility for allocations is Laziness: a computation is stored on the heap (a "thunk") to be done later. This does happen when mapping values over a tree, but both Set and IntervalSet are defined to be spine-strict, which means that the structure of the tree is always fully evaluated. Technically, it means that the node constructor will evaluate the left and right subtree arguments.
The mNode function turned out to be strict in all its arguments, but the interval annotation uses some functions from the Interval typeclass where the compiler can't infer strictness. Adding strictness via bang-patterns gave a small improvement:
Case Original New IntervalSet fromList 1000 2,643,136 2,302,576 IntervalSet fromAscList 989 224,688 205,608 IntervalSet fromDistinctAscList 989 163,440 143,920 IntervalSet mapMonotonic id 989 159,520 142,320 At this point I probably should have looked at the GHC produced core, to see where exactly the allocation happens. But I still decided to do some more code tuning first because I knew about one major case for inefficiency in the node construction even without allocation being necessarily involved. The node construction needs to determine the interval with the largest upper bound from two intervals, and that operation is not directly present in the Interval typeclass. Just comparing the upper bounds is not enough, since one of the intervals could be open and the other closed, in which case equal upper bounds turn out not to be equal after all. So this operation has to be synthesized from upperBound and rightClosed:
compareUpperBounds a b = case compare (upperBound a) (upperBound b) of LT -> LT GT -> GT EQ -> case (rightClosed a, rightClosed b) of (False, True) -> LT (True, False) -> GT _ -> EQ For most actual instances of Interval, the rightClosed function will return a constant value (e.g., rightClosed = const True), so that this function could be simplified to a single compare. But GHC can do this only if knows and can inline the concrete Interval instance used. This requires liberal use of the INLINABLE pragma and can lead to code and compile-time bloat. Data.Set does this to some extent, but I don't think it is feasible for IntervalSet.
So I bit the bullet and added this function and a default implementation to the Interval typeclass. Results:
Case Original New IntervalSet fromList 1000 2,643,136 576,208 IntervalSet fromAscList 989 224,688 110,760 IntervalSet fromDistinctAscList 989 163,440 47,488 IntervalSet mapMonotonic id 989 159,520 47,472 About perfect! I should add that along with the reduction in allocations comes a speed improvement of about 30 - 50% for all operations that manipulate sets. Same for IntervalMaps. Is it worth adding otherwise unneeded functions to the typeclass for that? I think yes. A new version of IntervalMap incorporating these speedups is already up on Hackage.
Categories: Offsite Blogs

LOPSTR 2016: 2nd Call for Papers

General haskell list - Wed, 06/01/2016 - 7:21pm
[ Please distribute, apologies for multiple postings. ] ====================================================================== LOPSTR 2016: 2nd Call for Papers ====================================================================== 26th International Symposium on Logic-Based Program Synthesis and Transformation LOPSTR 2016 http://cliplab.org/Conferences/LOPSTR16/ Edinburgh, UK, September 6-8, 2016 (co-located with PPDP 2016 and SAS 2016) ====================================================================== DEADLINES: Abstract submission: June 7, 2016 Paper/Extended abstract submission: June 14, 2016 ====================================================================== INVITED SPEAKERS: Francesco Logozzo (Facebook, USA) [jointly with PPDP] Greg Morrisett (Cornell University, USA) [jointly with PPDP] Martin Vechev (ETH Zurich, Switzerland) [jointly with SAS ] =====
Categories: Incoming News

Functional Jobs: CTO (Haskell/Clojure) at Capital Match (Full-time)

Planet Haskell - Wed, 06/01/2016 - 4:04am

Overview

Capital Match (www.capital-match.com) is a leading peer-to-peer lending platform in Singapore. Our in-house platform, mostly developed in Haskell, has in the last year seen more than USD 6 million business loans processed with a strong monthly growth (current rate of USD 1-2 million monthly).

We have just secured another funding round to build a world-class technology as the key business differentiator. The key components include credit risk engine, seamless banking integration and end-to-end product automation from loan origination to debt collection.

Responsibilities

We are looking to hire an experienced software engineer (min. 5-8 years coding experience) with a team lead and product management experience to lead the efforts. The current tech team includes a product manager and 3 software engineers. CTO would directly report to CEO and the Board of Directors.

The candidate should have been involved in a development of multiple web-based products from scratch. He should be interested in all aspects of the creation, growth and operations of a secure web-based platform: front-to-back features development, distributed deployment and automation in the cloud, build and test automation etc.

Background in fintech and especially lending space would be a great advantage.

Requirements

Our platform is primarily developed in Haskell with an Om/ClojureScript frontend. We are expecting our candidate to have experience working with a functional programming language e.g. Haskell/Scala/OCaml/F#/Clojure/Lisp/Erlang.

Deployment and production is managed with Docker containers using standard cloud infrastructure so familiarity with Linux systems, command-line environment and cloud-based deployment is mandatory. Minimum exposure to and understanding of XP practices (TDD, CI, Emergent Design, Refactoring, Peer review and programming, Continuous improvement) is expected.

We are looking for candidates that are living in or are willing to relocate to Singapore.

Offer

We offer a combination of salary and equity depending on experience and skills:

Salary: USD 6,000-8,000 / month

Equity: ca. 1% (subject to vesting)

European citizens who relocate to Singapore do not have to pay their home country taxes and the local tax rate in Singapore is more or less 5% (effective on the proposed salary range). Visa sponsorship will be provided.

Singapore is a great place to live, a vibrant city rich with diverse cultures, a very strong financial sector and a central location in Southeast Asia.

Get information on how to apply for this position.

Categories: Offsite Blogs

Functional Jobs: Software Engineer (Haskell/Clojure) at Capital Match (Full-time)

Planet Haskell - Wed, 06/01/2016 - 4:04am

Overview

Capital Match (www.capital-match.com) is a leading peer-to-peer lending platform in Singapore. Our in-house platform, mostly developed in Haskell, has in the last year seen more than USD 6 million business loans processed with a strong monthly growth (current rate of USD 1-2 million monthly).

We have just secured another funding round to build a world-class technology as the key business differentiator. The key components include credit risk engine, seamless banking integration and end-to-end product automation from loan origination to debt collection.

Responsibilities

We are looking to hire a software engineer with a minimum of 2-3 years coding experience. The current tech team includes a product manager and 3 software engineers. We are currently also in the process of hiring CTO.

The candidate should have been involved in a development of multiple web-based products from scratch. He should be interested in all aspects of the creation, growth and operations of a secure web-based platform: front-to-back features development, distributed deployment and automation in the cloud, build and test automation etc.

Background in fintech and especially lending space would be a great advantage.

Requirements

Our platform is primarily developed in Haskell with an Om/ClojureScript frontend. We are expecting our candidate to have experience working with a functional programming language e.g. Haskell/Scala/OCaml/F#/Clojure/Lisp/Erlang.

Deployment and production is managed with Docker containers using standard cloud infrastructure so familiarity with Linux systems, command-line environment and cloud-based deployment is mandatory. Minimum exposure to and understanding of XP practices (TDD, CI, Emergent Design, Refactoring, Peer review and programming, Continuous improvement) is expected.

We are looking for candidates that are living in or are willing to relocate to Singapore.

Offer

We offer a combination of salary and equity depending on experience and skills:

Salary: USD 3,500-5,000 / month

Equity: ca. 0.5% (subject to vesting)

European citizens who relocate to Singapore do not have to pay their home country taxes and the local tax rate in Singapore is more or less 5% (effective on the proposed salary range). Visa sponsorship will be provided.

Singapore is a great place to live, a vibrant city rich with diverse cultures, a very strong financial sector and a central location in Southeast Asia.

Get information on how to apply for this position.

Categories: Offsite Blogs

Douglas M. Auclair (geophf): May 2016 1HaskellADay Problems and Solutions

Planet Haskell - Wed, 06/01/2016 - 2:55am
May 2016
  • May 31st, 2016: Today's #haskell problem gets a subsequence of DNA from ... DNA! http://lpaste.net/1527607897389793280 Today's #haskell solution: DNA subsequence GOT http://lpaste.net/5828328688629841920
  • May 30th, 2016: We find the number of RNA strands that can generate a protein ... modulo reasonableness for today's #haskell problem http://lpaste.net/7114368903530151936 Today's #haskell solution shows us there are 'more than a few' RNA strands to compose some proteins http://lpaste.net/3827843057999413248
  • May 27th, 2016: For today's #haskell problem we sing: No woman, Nah Trie! http://lpaste.net/8137189406290214912 Or: Breath-first Trie Traversal via the branches. We take breathing-lessons for today's #haskell solution http://lpaste.net/2088953736360624128
  • May 26th, 2016: For today's #haskell problem we label the nodes of a Trie ... http://lpaste.net/658981668358455296 or at least we ... TRIE to! *groan Today's #haskell solution is a depth-first traversal of a Triehttp://lpaste.net/7964088321452277760
  • May 25th, 2016: Today's #haskell problem ask you to exercise your probability muscles and look at some allele-pairingshttp://lpaste.net/7098281613896712192 That's all.
  • May 24th, 2016: Reverse Palindromes in DNA strands?Yes. http://lpaste.net/4547532761941934080 Today's #haskell problem. Turns out there are lots of palindromes in DNA strands as today's #haskell solution shows. http://lpaste.net/8959978868165312512 Go figure.
  • May 23rd, 2016: Splice, splice, baby! We get all Vanilla Ice with RNA with today's #haskell problem http://lpaste.net/2811938573572374528 We get our protein when with today's hand-rolled List-y-(\\) #haskell solution http://lpaste.net/5823105188059152384
  • May 20th, 2016: For today's #haskell problem we consider the weighty matter of ... weighing matter http://lpaste.net/7500383126527410176 The weight's the thing Wherein I'll catch the conscience of the King ... no ... weight ...Today's #haskell solution http://lpaste.net/7743348996965400576
  • May 19th, 2016: Today's #haskell problem looks at the Carmina Buranahttp://lpaste.net/684224423812661248 ... uh, no, it doesn't: Open Reading Frames.  Today's #haskell solution sequences DNA strands to proteins http://lpaste.net/792645775074000896
  • May 18th, 2016: If at first you do not succeed, trie and trie again today's #haskell problem http://lpaste.net/8558987235213443072 #trie #datatype 
  • May 17th, 2016: "Houston. We have a problem." #bigdata factors into today's #haskell problem of longest monotonic sequenceshttp://lpaste.net/6778179741435297792
  • May 16th, 2016: Today's #Haskell problem asks for longest monotonic increasing/decreasing sequences ... in the small ... http://lpaste.net/7252474989977272320 So, the #haskell solution works against small data set, but since it's bifurcating, against large data sets? ... http://lpaste.net/7003206401061289984
  • May 13th, 2016: #Rosalind is impatient. She doesn't have all day! Let's find a real-world solution to today's #haskell problem http://lpaste.net/8254705170412208128 Finding the longest common gene subsequence of 100 strands each 1000 nucleotides long in #haskell http://lpaste.net/2468395370904813568 Can you find faster?
  • May 12th, 2016: We propose a little problem from Set Theory for today's #haskell problem http://lpaste.net/4050317579338645504 And we have today's #haskell in-a-perfect-world solution of the set-intersection of all subsequenceshttp://lpaste.net/1682855623517011968
  • May 11th, 2016: Today's #haskell problem is all about the inods ... not 'inodes,' but 'internal nodes of an unrooted binary tree.' http://lpaste.net/7455193258755358720 "inods?" you say? "Of an unrooted binary tree?" you say? That would be pred . pred for today's #haskell solution http://lpaste.net/4766815087493120000
  • May 10th, 2016: For today's #haskell problem we take it to the next level, see? and get variable-length strings as enumerated tokens http://lpaste.net/3180555571975684096 We pulled the powerSet Set.fromList Set.toList switcheroo for today's #haskell solution. http://lpaste.net/7501776843414962176
  • May 9th, 2016: For today's #haskell problem we sing our A, B, Cs ... #Rosalind-style! http://lpaste.net/1445499963915108352 Today's #Haskell solution enumerates lexed tokens http://lpaste.net/503582828101894144
  • May 6th, 2016: For today's #haskell problem we ask #Rosalind and she says 'Permutations.' So that's what we do! http://lpaste.net/6558920694606856192 This is the dawning of the age of Aquarius! "Hair" a movie about perms for today's #haskell solution http://lpaste.net/934285743432400896 @NickiElson3D 
  • May 5th, 2016: Today's #haskell problem: p-distance Matriceshttp://lpaste.net/818771459840147456 Believe you me: you will get a LOT of continued employment with these Today's #haskell solution is filed under #jobsecurity http://lpaste.net/5076187573303377920 #distanceMatrix
  • May 4th, 2016: Today's #haskell problem we look at completing a graph into the Tree of Life http://lpaste.net/1315899789614776320 #Rosalind Today's #haskell solution is graph-y, or also take the approach of @bazzargh http://lpaste.net/1052721051462533120
  • May 3rd, 2016: Today's #haskell problem looks at overlapping graphs, specifically for DNA strands from rosalind.info http://lpaste.net/8920617631791185920 Did you know a list is a graph? Today's #haskell solution was an elaboration of `isSuffixOf` http://lpaste.net/5785600391169179648 #Rosalind 
  • May 2nd, 2016: For today's #haskell problem we look at transforming our data into d3: "Data-driven document"-JSONhttp://lpaste.net/224067301371019264 For the #haskell solution we get a bird's-eye view of the Top5s stocks http://lpaste.net/7060337987313205248 
Categories: Offsite Blogs

ANN: Haskell for Mac trials & educational discount

General haskell list - Wed, 06/01/2016 - 1:51am
Haskell for Mac, the Haskell IDE with interactive playgrounds, now offers a free 14 day trial and educational discounts: http://haskellformac.com Manuel
Categories: Incoming News

SIGPLAN Programming Languages Mentoring Workshop < at >ICFP

haskell-cafe - Tue, 05/31/2016 - 11:02pm
SIGPLAN Programming Languages Mentoring Workshop < at > ICFP Nara, Japan (co-located with ICFP 2016) Sunday, September 18th, 2016 http://conf.researchr.org/track/icfp-2016/PLMW-ICFP-2016/ We are pleased to invite students interested in functional programming research to the programming languages mentoring workshop at ICFP. The goal of this workshop is to introduce senior undergraduate and early graduate students to research topics in functional programming as well as provide career mentoring advice. We have recruited leaders from the functional programming community to provide overviews of current research topics and give students valuable advice about how to thrive in graduate school, search for a job, and cultivate habits and skills that will help them in research careers. This workshop is part of the activities surrounding ICFP, the International Conference on Functional Programming, and takes place the day before the main conference. One goal of the workshop is to make the ICFP conference more accessible t
Categories: Offsite Discussion

SIGPLAN Programming Languages Mentoring Workshop < at > ICFP

General haskell list - Tue, 05/31/2016 - 11:02pm
SIGPLAN Programming Languages Mentoring Workshop < at > ICFP Nara, Japan (co-located with ICFP 2016) Sunday, September 18th, 2016 http://conf.researchr.org/track/icfp-2016/PLMW-ICFP-2016/ We are pleased to invite students interested in functional programming research to the programming languages mentoring workshop at ICFP. The goal of this workshop is to introduce senior undergraduate and early graduate students to research topics in functional programming as well as provide career mentoring advice. We have recruited leaders from the functional programming community to provide overviews of current research topics and give students valuable advice about how to thrive in graduate school, search for a job, and cultivate habits and skills that will help them in research careers. This workshop is part of the activities surrounding ICFP, the International Conference on Functional Programming, and takes place the day before the main conference. One goal of the workshop is to make the ICFP conference more accessible t
Categories: Incoming News

Jan Stolarek: Installing OCaml under openSUSE 11.4, or: “the compilation of conf-ncurses failed”

Planet Haskell - Tue, 05/31/2016 - 6:29am

Recently I decided to learn the basics of OCaml and I spent yesterday installing the compiler and some basic tools. On my machine at work I have a Debian 7 installation, while on my home laptop I have openSUSE 11.4. Both systems are quite dated and ship with OCaml 3.x compiler, which is five years old. Obviously, I wanted to have the latest version of the language. I could have compiled OCaml from sources – and in fact I have done that in the past to compile the latest version of Coq – but luckily there is a tool called OPAM (OCaml Package manager). OPAM can be used to easily download and install desired version of OCaml compiler. As the name implies, OPAM can be also used for managing packages installed for a particular compiler version.

The installation process went very smooth on my Debian machine, but on openSUSE I have run into problems. After getting the latest compiler I wanted to install ocamlfind, a tool required by a project I wanted to play with. To my disappointment installation ended with an error:

[ERROR] The compilation of conf-ncurses failed at "pkg-config ncurses".   This package relies on external (system) dependencies that may be missing. `opam depext conf-ncurses.1' may help you find the correct installation for your system.

I verified that I indeed have installed development files for the ncurses library as well as the pkg-config tool. Running the suggested opam command also didn’t find any missing dependencies, and the log files from the installation turned out to be completely empty, so I was left clueless. Googling revealed that I am not the first to encounter this problem, but offered no solution. I did some more reading on pkg-config and learned that: a) it is a tool that provides meta-information about installed libraries, and b) in order to recognize that a library is installed it requires extra configuration files (aka *.pc files) provided by the library. Running pkg-config --list-all revealed that ncurses is not recognized as installed on my system, which suggested that the relevant *.pc files are missing. Some more googling revealed that ncurses library can be configured and then compiled with --enable-pc-files switch, which should build the files needed by pkg-config. I got the sources for the ncurses version installed on my system (5.7) only to learn that this build option is unsupported. This explains why the files are missing on my system. I got the sources for the latest version of ncurses (6.0), configured them with --enable-pc-files and compiled, only to learn that the *.pc files were not built. After several minutes of debugging I realized that for some unexplained reasons the configure-generated script which should build the *.pc files (located at misc/gen-pkgconfig) did not receive +x (executable) permission. After adding this permission manually I ran the script and got five *.pc files for the ncurses 6.0 library. Then I had to edit the files to match the version of ncurses of my system – relevant information can be obtained by running ncurses5-config --version. The only remaining thing was to place the five *.pc files in a place where pkg-config can find them. On openSUSE this was /usr/local/pkgconfig, but this can differ between various Linux flavours.

After all these magical incantations the installation of ocamlfind went through fine and I can enjoy a working OCaml installation on both of my machines. Now I’m waiting for the “Real-world OCaml” book ordered from Amazon (orders shipped from UK Amazon to Poland tend to take around two weeks to arrive).

Categories: Offsite Blogs

2nd Call for Papers: WFLP 2016 - Update: EPTCS Proceedings

General haskell list - Mon, 05/30/2016 - 5:19pm
24th International Workshop on Functional and (Constraint) Logic Programming (WFLP 2016) https://wflp2016.github.io/ September 13-14, part of the Leipzig Week of Declarative Programming (L-DEC 2016) *********************************************************** Deadlines: * abstract submission: June 15, 2016 * paper submission: June 22, 2016 * notification: July 15, 2016 * camera-ready (workshop) version due: August 10, 2016 Papers can be directly accepted for publication in the formal EPTCS proceedings, or accepted for presentation at the workshop and invited to another round of reviewing after revision. More details on the web page. *********************************************************** The international workshops on functional and (constraint) logic programming aim at bringing together researchers, students, and practitioners interested in functional programming, logic programming, and their integration. This year the workshop is co-located with two other events as part of http://nfa.imn.htwk-le
Categories: Incoming News

DEADLINE EXTENSION: 19th ACM/IEEE MSWiM 2016 - Malta,Nov 13-17, 2016

General haskell list - Mon, 05/30/2016 - 4:05pm
=================================================== Call-For-Papers: 19th ACM/IEEE MSWiM 2016 Malta, Nov 13-17, 2016 http://www.mswimconf.com/2016 ==================================================== IMPORTANT: Submission deadline Extended: Paper registration through EDAS: June 8th, 2016 Paper Submission: June 12th, 2016 =================================================== ------ ACM/IEEE* MSWiM 2016 is the 19th Annual International Conference on Modeling, Analysis and Simulation of Wireless and Mobile Systems. MSWiM is an international forum dedicated to in-depth discussion of Wireless and Mobile systems, networks, algorithms and applications, with an emphasis on rigorous performance evaluation. MSWiM is a highly selective conference with a long track record of publishing innovative ideas and breakthroughs. MSWiM 2016 will be held Malta, Nov 13-17, 2016 Authors are encouraged to submit full papers presenting new research related to the theory or prac
Categories: Incoming News

Philip Wadler: Speaker's Trust removes all trace of Leanne Baghouti

Planet Haskell - Mon, 05/30/2016 - 3:42pm
Leanne Baghouti, a British-Palestinian won her local round of Speaker's Trust "Speak Out" competition with an impassioned talk about Palestinian human rights. Her talk, and all sign that she had won the competition, were later deleted from the competition web site.

A colleague characterised her talk as "full of anti-Semitic and aggressive material from sources in the Middle East". I watched the video, and heard nothing anti-Semitic. It is a word that should be used with care.

Speaker's Trust has released a statement regarding the matter:
“There are two fundamental rules that are made explicit during the training: the speech must have a positive and uplifting message – in fact this is one of the core terms of the agreement with the Jack Petchey Foundation [and] a speaker should never inflame or offend the audience or insult others and this, by definition, means that propaganda is ruled out absolutely from the outset… Speakers Trust and Jack Petchey Foundation judging panel decided unanimously against sending Leanne Mohamad through to the next stage and she will not be speaking at the Grand Final. These were precisely our concerns.”And another:
Our primary duty of care is to the young people we work with and we cannot tolerate any form of insult or abuse. We are concerned and saddened that Leanne’s experience has been less than positive.
Leanne Mohamad is the Redbridge Regional Final winner and there has never been any suggestion that she should be disqualified. Almost 190,000 young people have spoken out over the years on any topic which they feel passionately about and none has ever been banned from the process or silenced.
We are, however, a small charity without the capacity to moderate comments 24 hours a day and it was considered essential to protect Leanne by temporarily suspending the regional video over the bank holiday, until we were able to consult with her school and family.
Of 37 talented regional Champions only fifteen can be voted through to the Grand Final. This selection process took place on Saturday 21st May based on standard judging criteria and without any external influence or input.
The general “rules” of effective public speaking are guidelines to help speakers to create a speech that will connect with a large and diverse audience and every speech was judged on its own merits. At the heart of what we do lies the determination that all of our young speakers, irrespective of background, race or creed, should be able to speak out in a safe and supportive environment.
Categories: Offsite Blogs

Proposal: Add // for Data.Sequence

libraries list - Mon, 05/30/2016 - 2:21pm
BACKGROUND ---------- Data.Array provides (//) for incremental array updates. Data.Sequence lacks this useful functionality. SCOPE ----- Doing this efficiently may require that Data.Sequence access Data.IntMap. (It currently does not.) David Feuer commented: We may need to add some more splitting functions to Data.IntMap, if it supports them, but we probably want to do so anyway to match up with Data.Map. SOLUTIONS ----------- David Feuer offered the following implementation sketch. (See https://github.com/haskell/containers/issues/262) Collect all requested changes into an IntMap, then use something similar to Data.Sequence.splitMap with Data.IntMap.split to spread them through the tree. David Feuer commented: splitMap itself is overkill, because we'll likely be able to preserve whole subtrees. WHAT MIGHT BREAK ---------------- No anticipated breakage.
Categories: Offsite Discussion

configurable mapping between data declarations andgiven XML schema?

haskell-cafe - Mon, 05/30/2016 - 11:04am
Dear Cafe, I have a legacy XML schema, and some Haskell data declarations. I want to map bidirectionally between XML documents and data. I absolutely cannot change the schema. I could change the data declarations, but it would not help much, since I don't think there is any form of declaring data that would allow me to derive the transformations generically. So, I have a mess of ad-hoc transformations. What could be done about this? I think I need "generic with customization". More detail: https://github.com/jwaldmann/haskell-tpdb/issues/16 Comments appreciated. - J.W.
Categories: Offsite Discussion

Philip Wadler: Omar Barghouti banned by Israel for travelling for supporting BDS

Planet Haskell - Mon, 05/30/2016 - 3:35am
Omar Barghouti, a Palestinian living in Israel, has been denied the right to travel, for no reason other than that he is an effective supporter of BDS (Boycott, Divestment, Sanctions). Glenn Greenwald interviews him in The Intercept.
Despite having lived in Israel for 22 years with no criminal record of any kind, Omar Barghouti (above) was this week denied the right to travel outside the country. As one of the pioneers of the increasingly powerful movement to impose boycotts, sanctions, and divestment measures (BDS) on Israel, Barghouti, an articulate, English-speaking activist, has frequently traveled around the world advocating his position. The Israeli government’s refusal to allow him to travel is obviously intended to suppress his speech and activism. Prime Minister Benjamin Netanyahu was one of the world leaders who traveled last year to Paris to participate in that city’s “free speech rally.” ...

Sarah Leah Whitson of Human Rights Watch told the Electronic Intifada that “Israel’s refusal to renew Barghouti’s travel document appears to be an effort to punish him for exercising his right to engage in peaceful, political activism, using its arsenal of bureaucratic control over Palestinian lives.” She added: “Israel has used this sort of control to arbitrarily ban many Palestinians from traveling, as well as to ban international human rights monitors, journalists, and activists from entering Israel and the occupied Palestinian territories.” ...

Barghouti: Many people are realizing that Israel is a regime of occupation, settler colonialism, and apartheid and are therefore taking action to hold it to account to international law. Israel is realizing that companies are abandoning their projects in Israel that violate international law, pension funds are doing the same, major artists are refusing to play Tel Aviv, as Sun City was boycotted during apartheid South Africa. ...

We live in a country where racism and racial incitement against indigenous Palestinians has grown tremendously into the Israeli mainstream. It has really become mainstream today to be very openly racist against Palestinians. Many settlers and hard-right-wing Israelis are taking matters into their own hands – completely supported by the state – and attacking Palestinians.
Categories: Offsite Blogs

Discussion: Add total indexing function to Data.Sequence

libraries list - Sun, 05/29/2016 - 10:21pm
Data.Sequence offers index :: Seq a -> Int -> a which throws an error if the index is out of range. I'd like to add something like indexMay :: Seq a -> Int -> Maybe a Aside from the safety factor, indexMay would offer a way to ensure the indexing occurs at a particular time. Much like Data.Vector.indexM, this can help prevent memory leaks. In fact, an analogue of indexM can be implemented in terms of indexMay: indexM :: Applicative m => Seq a -> Int -> m a indexM xs i = case xs `indexMay` i of Nothing -> error "indexM: index out of range" Just x -> pure x
Categories: Offsite Discussion

Proposal: Add insertAt to Data.Sequence

libraries list - Sun, 05/29/2016 - 9:32pm
I've come up with an implementation of insertAt :: Int -> a -> Seq a -> Seq a
Categories: Offsite Discussion

JSON parser that returns the rest of the string thatwas not used

haskell-cafe - Sun, 05/29/2016 - 6:09pm
As someone who spent many years putting data in S-expression format, it seems natural to me to write multiple S-expressions (or JSON objects) to a file, and expect a reader to be able to read them back one at a time. This seems comparatively uncommon in the JSON world. Accordingly, it looks like the most popular JSON parsing lib, Aeson, doesn't directly provide this functionality. Functions like decode just return a "Maybe a", not the left-over input, meaning that you would need to somehow split up your multi-object file before attempting to parse, which is annoying and error prone. It looks like maybe you can get Aeson to do what I want by dropping down to the attoparsec layer and messing with IResult. But is there a better way to do this? Would this be a good convenience routine to add to aeson in a PR? I.e. would anyone else use this? Thanks, -Ryan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/h
Categories: Offsite Discussion

Testing for different dependency versions?

haskell-cafe - Sun, 05/29/2016 - 5:33am
Hi, I was wondering: what is the most practical way to go about testing or otherwise determining if your packaged library works with other dependency versions? E.g., cabal init specified base 4.6 because that is what happens to be installed on my Debian Jessie system, but that wouldn't even build on hackage.
Categories: Offsite Discussion

Quantum Programming EDSLs other than Quipper

haskell-cafe - Sat, 05/28/2016 - 4:04pm
Hi all, Quipper [1] is a well-known library that provides an EDSL for writing and simulating quantum algorithms in Haskell. I was wondering if there was any other attempt to design an EDSL in Haskell to express quantum algorithms. In particular, Quipper is not able to statically ensure that the algorithm written is physically meaningful, as one could violate the "non-cloning property", for example (a qubit cannot be copied, for those who do not speak quantumly). Violations like this are detected at runtime when simulating the algorithm or when producing the corresponding circuit as output. Authors of Quipper already said that some of those properties could be possible to check “if Haskell had linear types”. The point is that Haskell's support for dependently typed programming has grown quite a lot in the last years, and I think that, at least theoretically, something better can now be achieved. So do anyone know any more recent attempt to express quantum computations in an Haskell EDSL that levera
Categories: Offsite Discussion