News aggregator

Call for Papers: WFLP 2016 - Workshop on Functional and (Constraint) Logic Programming

General haskell list - Fri, 05/13/2016 - 6:19pm
24th International Workshop on Functional and (Constraint) Logic Programming (WFLP 2016) 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 * final version due: August 10, 2016 *********************************************************** 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 in order to promote the cross-fertilizing exchange of ideas and experiences among and between the communities interested in the foundations, applications, and combinations of high-level, declarative programming lan
Categories: Incoming News

SPLASH-I 2016: Call for Talk Proposals!

General haskell list - Wed, 05/11/2016 - 12:05pm
SPLASH-I: Innovation, Interaction, Insight, Industry, Invited The ACM SIGPLAN conference on Systems, Programming, Languages and Applications: Software for Humanity (SPLASH) embraces all aspects of software construction and delivery to make it the premier conference at the intersection of programming, languages, and software engineering. SPLASH 2016 will take place from Sunday, October 30 to Friday, November 4, 2016 in Amsterdam, The Netherlands. SPLASH-I is the track of SPLASH dedicated to great talks on exciting topics! SPLASH-I will run in parallel with all of SPLASH (during the week days), and is open to all attendees. SPLASH-I will host both invited talks and selected talks submitted via this call for proposals. SPLASH-I solicits inspiring talks, tutorials and demonstrations on exciting topics related to programming and programming systems, delivered by excellent speakers from academia or industry. SPLASH-I caters for three categories of presentations: - Regular talks on programming languages, system
Categories: Incoming News

Template Haskell Tutorial

haskell-cafe - Wed, 05/11/2016 - 11:49am
Hi, I've been diving into Template Haskell recently and thought to write down what I've learned. The result hopes to be a practical, example-driven introduction to Template Haskell's main features: I hope it serves others new to Template Haskell. It's all on the Haskell wiki, so feedback and improvements are welcome! Cheers, Dominik.
Categories: Offsite Discussion

SPLASH 2016: Call for Sponsorships

General haskell list - Tue, 05/10/2016 - 11:54pm
The ACM SIGPLAN conference on Systems, Programming, Languages and Applications: Software for Humanity (SPLASH) embraces all aspects of software construction and delivery to make it the premier conference at the intersection of programming, languages, and software engineering. SPLASH 2016 will take place from Sunday, October 30 to Friday, November 4, 2016 in Amsterdam, The Netherlands. Web version of this call for sponsorships: SPLASH is where the best of the best in software innovation, programming and programming languages convene, learn from and inspire each other, and share their passion for software. Supporting SPLASH is an opportunity to put your corporate name in front of this community — a superb investment for your organization. # Sponsorship Packages ## Diamond: $US 15 000 Benefits: - Recognition as a supporter in print and on the web. Recognized as a Diamond supporter on registration brochures and conference program - Two company-provided i
Categories: Incoming News

OAuth2 and OpenID Connect in Haskell

haskell-cafe - Tue, 05/10/2016 - 10:49pm
Hello all, I've written a blog article as an introduction to the Haskell project I've been working on, which may be of interest to some people here. It's an OpenID Connect identity provider. I'd really welcome any feedback on other/better ways of doing some of things it talks about. Cheers, Luke.
Categories: Offsite Discussion

Jasper Van der Jeugt: On Ad-hoc Datatypes

Planet Haskell - Tue, 05/10/2016 - 6:00pm

In Haskell, it is extremely easy for the programmer to add a quick datatype. It does not have to take more than a few lines. This is useful to add auxiliary, ad-hoc datatypes.

I don’t think this is used enough. Most libraries and code I see use “heavier” datatypes: canonical and very well-thought-out datatypes, followed by dozens of instances and related functions. These are of course great to work with, but it doesn’t have to be a restriction: adding quick datatypes – without all these instances and auxiliary functions – often makes code easier to read.

The key idea is that, in order to make code as simple as possible, you want to represent your data as simply as possible. However, the definition of “simple” is not the same in every context. Sometimes, looking at your data from another perspective makes specific tasks easier. In those cases, introducing “quick-and-dirty” datatypes often makes code cleaner.

This blogpost is written in literate Haskell so you should be able to just load it up in GHCi and play around with it. You can find the raw .lhs file here.

> import Control.Monad (forM_)

Let’s look at a quick example. Here, we have a definition of a shopping cart in a fruit store.

> data Fruit = Banana | Apple | Orange > deriving (Show, Eq) > > type Cart = [(Fruit, Int)]

And we have a few functions to inspect it.

> cartIsHomogeneous :: Cart -> Bool > cartIsHomogeneous [] = True > cartIsHomogeneous ((fruit, _) : xs) = all ((== fruit) . fst) xs > cartTotalItems :: Cart -> Int > cartTotalItems = sum . map snd

This is very much like code you typically see in Haskell codebases (of course, with more complex datatypes than this simple example).

The last function we want to add is printing a cart. The exact way we format it depends on what is in the cart. There are four possible scenarios.

  1. The cart is empty.
  2. There is a single item in the customers cart and we have some sort of simplified checkout.
  3. The customer buys three or more of the same fruit (and nothing else). In that case we give out a bonus.
  4. None of the above.

This is clearly a good candidate for Haskell’s case statement and guards. Let’s try that.

> printCart :: Cart -> IO () > printCart cart = case cart of > [] -> putStrLn $ "Your cart is empty" > [(fruit, 1)] -> putStrLn $ "You are buying one " ++ show fruit > _ | cartIsHomogeneous cart && cartTotalItems cart >= 3 -> do > putStrLn $ > show (cartTotalItems cart) ++ > " " ++ show (fst $ head cart) ++ "s" ++ > " for you!" > putStrLn "BONUS GET!" > | otherwise -> do > putStrLn $ "Your cart: " > forM_ cart $ \(fruit, num) -> > putStrLn $ "- " ++ show num ++ " " ++ show fruit

This is not very nice. The business logic is interspersed with the printing code. We could clean it up by adding additional predicates such as cartIsBonus, but having too many of these predicates leads to a certain kind of Boolean Blindness.

Instead, it seems much nicer to introduce a temporary type:

> data CartView > = EmptyCart > | SingleCart Fruit > | BonusCart Fruit Int > | GeneralCart Cart

This allows us to decompose our printCart into two clean parts: classifying the cart, and printing it.

> cartView :: Cart -> CartView > cartView [] = EmptyCart > cartView [(fruit, 1)] = SingleCart fruit > cartView cart > | cartIsHomogeneous cart && cartTotalItems cart >= 3 = > BonusCart (fst $ head cart) (cartTotalItems cart) > | otherwise = GeneralCart cart

Note that we now have a single location where we classify the cart. This is useful if we need this information in multiple places. If we chose to solve the problem by adding additional predicates such has cartIsBonus instead, we would still have to watch out that we check these predicates in the same order everywhere. Furthermore, if we need to add a case, we can simply add a constructor to this datatype, and the compiler will tell us where we need to update our code 1.

Our printCart becomes very simple now:

> printCart2 :: Cart -> IO () > printCart2 cart = case cartView cart of > EmptyCart -> putStrLn $ "Your cart is empty" > SingleCart fruit -> putStrLn $ "You are buying one " ++ show fruit > BonusCart fruit n -> do > putStrLn $ show n ++ " " ++ show fruit ++ "s for you!" > putStrLn "BONUS GET!" > GeneralCart items -> do > putStrLn $ "Your cart: " > forM_ items $ \(fruit, num) -> > putStrLn $ "- " ++ show num ++ " " ++ show fruit

Of course, it goes without saying that ad-hoc datatypes that are only used locally should not be exported from the module – otherwise you end up with a mess again.

  1. If you are compiling with -Wall, which is what you really, really should be doing.

Categories: Offsite Blogs

Using parallels for fibonacci

haskell-cafe - Tue, 05/10/2016 - 5:39pm
I am trying to efficiently use multicores for my fizzbuzz <> project. My fizzbuzz uses a Fibonacci generator as input, and this is where it can get computationally heavy. I believe I have picked the best algorithm for my project (please correct this if wrong), and now I am trying to use the parallel package <>. I am not getting any better performance in the sense that if I try to compute the 100th Fibonacci number, it is still computing , using 4 cores, several minutes later. Here is my attempt. Please show me how to use this library right. from src/FizzBuzz.hs fizzBuzzFib :: Integer -> [Text] fizzBuzzFib ub = parMap rdeepseq fizzbuzz $! fibSeq ub from src/FizzFub.hs fibSeq :: Integer -> [Integer] fibSeq ub = withStrategy (parBuffer buffer rdeepseq) $ genericTake ub fibbwhere buffer = 100 fibb :: [Integer] fibb = 0 : 1 : zipWith (+) fibb (tail fibb) _______________________________________________ Haskell-Cafe ma
Categories: Offsite Discussion

Trustworthy Refactoring project: Research AssociatePositions in Refactoring Functional Programs and FormalVerification (for CakeML)

General haskell list - Tue, 05/10/2016 - 4:33pm
Trustworthy Refactoring project: Research Associate Positions in Refactoring Functional Programs and Formal Verification (for CakeML) The Trustworthy Refactoring project at the University of Kent is seeking to recruit postdoc research associates for two 3.5 year positions, to start in September this year. The overall goal of this project is to make a step change in the practice of refactoring by designing and constructing of trustworthy refactoring tools. By this we mean that when refactorings are performed, the tools will provide strong evidence that the refactoring has not changed the behaviour of the code, built on a solid theoretical understanding of the semantics of the language. Our approach will provide different levels of assurance from the (strongest) case of a fully formal proof that a refactoring can be trusted to work on all programs, given some pre-conditions, to other, more generally applicable guarantees, that a refactoring applied to a particular program does not change the behaviour of t
Categories: Incoming News

A Farewell to FRP in Elm

Lambda the Ultimate - Tue, 05/10/2016 - 9:24am

Making signals unnecessary with The Elm Architecture

...the big benefit is that Elm is now significantly easier to learn and use. As the design of subscriptions emerged, we saw that all the toughest concepts in Elm (signals, addresses, and ports) could collapse into simpler concepts in this new world. Elm is designed for ease-of-use, so I was delighted to stumble upon a path that would take us farther with fewer concepts. To put this in more alarmist terms, everything related to signals has been replaced with something simpler and nicer.

Categories: Offsite Discussion

Summer of Haskell Mentors

General haskell list - Tue, 05/10/2016 - 3:31am
If you are interesting in helping out as a possible mentor for this year's Summer of Haskell, please email me, and include MENTOR in the title. Thank you! -Edward
Categories: Incoming News

origin of my fibonacci test

haskell-cafe - Tue, 05/10/2016 - 12:59am
I have some code that checks to see if a number is a fibonacci number. It's not mine, I got it from somewhere and I need to credit it. I am pretty sure I got it from Stack Exchange but my search for it went nowhere. If this looks familiar to you, or you can tell me better ways to search, please let me know. isFib :: Integer -> Bool isFib n = n == a where (_, a, _) = unFib (1, 1) n unFib :: (Integer, Integer) -> Integer -> (Integer,Integer,Integer) unFib (a, b) n | n < a = (0, 0, 1) | n < e = (2*k, c, d) | otherwise = (2*k + 1, e, f) where (k, c, d) = unFib (fibPlus (a, b) (a, b)) n (e, f) = fibPlus (a, b) (c, d) fibPlus :: (Integer, Integer) -> (Integer, Integer) -> (Integer,Integer) fibPlus (a, b) (c, d) = (bd - (b - a)*(d - c), a*c + bd) where bd = b*d _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Myrtle Software is looking for Haskell developers for exciting graphics/compilers/hardware work

haskell-cafe - Mon, 05/09/2016 - 6:08pm We're a small software company in Cambridge, UK. We are working on some cool tech for lowering image processing algorithms to efficient hardware designs with a focus on putting these in autonomous vehicles. Our compiler is written completely in Haskell as well as some other tools we've written in house. We are looking to hire some more Haskell talent to help drive things forward. Please ask if you have any questions!
Categories: Offsite Discussion

WST 2016 - First Call for Papers

haskell-cafe - Mon, 05/09/2016 - 3:41pm
========================================================================== WST 2016 - 1st Call for Papers 15th International Workshop on Termination September 5-7, 2016, Obergurgl, Austria ========================================================================== The Workshop on Termination (WST) traditionally brings together, in an informal setting, researchers interested in all aspects of termination, whether this interest be practical or theoretical, primary or derived. The workshop also provides a ground for cross-fertilization of ideas from term rewriting and from the different programming language communities. The friendly atmosphere enables fruitful exchanges leading to joint research and subsequent publications. The event is held as part of CLA 2016 IMPORTANT DATES: * submission June 22, 2016 * n
Categories: Offsite Discussion

suboptimal ghc code generation in IO vs equivalent pure code case

glasgow-user - Mon, 05/09/2016 - 3:23pm
I have a loop which runs millions of times. For some reason I have to run it in the IO monad. I noticed that when I convert the code from pure to IO monad the generated assembly code in essence is almost identical except one difference where it puts a piece of code in a separate block which is making a huge difference in performance (4-6x slower). I want to understand what makes GHC to generate code in this way and if there is anything that can be done at source level (or ghc option) to control that. The pure code looks like this: decomposeChars :: [Char] -> [Char] decomposeChars [] = [] decomposeChars [x] = case NFD.isDecomposable x of True -> decomposeChars (NFD.decomposeChar x) False -> [x] decomposeChars (x : xs) = decomposeChars [x] ++ decomposeChars xs The equivalent IO code is this: decomposeStrIO :: [Char] -> IO [Char] decomposeStrPtr !p = decomposeStrIO where decomposeStrIO
Categories: Offsite Discussion

Problems with function recursion in Haskell

haskell-cafe - Mon, 05/09/2016 - 2:30pm
Hi, I'm new in Haskell and I need help in recursion. That function below is returning "*** Exception: Prelude.head: empty list" and I need resolve that: execNTimes 0 [] = return() execNTimes n xs = if n<=0 || null xs then return() else do si <- getLine let s = words si l = read (s !! 1) :: Int r = read (s !! 2) :: Int if head s=="Q" then do let z = slice l r xs m = foldl lcm 1 z print (m `mod` (toInteger 1000000007)) else do let s1 = update l r xs execNTimes (n-1) s1 execNTimes (n-1) xs Anybody can me help? Thank you, Josenildo Silva
Categories: Offsite Discussion

LPTI'16 Call for Papers

General haskell list - Mon, 05/09/2016 - 11:30am
Call for Papers Workshop on Logic Programming for Type Inference 16-17 October 2016, New York, USA Objectives and scope ------------------- Two facts are universally acknowledged: critical software must be subject to formal verification and modern verification tools need to scale and become more user-friendly in order to make more impact in industry. There are two major styles of verification: algorithmic : verification problems are specified in an automated prover, e.g. (constraint) logic programming or SMT solver, and properties of interest are verified by the prover automatically. Such provers can be fast, but their trustworthiness is hard to establish without producing and checking proofs. An alternative is a typeful approach to verification: instead of verifying programs in an external prover, a programmer may record all properties of interest as types of functions in his programs. Thanks to Curry-Howard isomorphism, type inhabitants also play the rol
Categories: Incoming News

CFP: WADT 2016

General haskell list - Mon, 05/09/2016 - 11:13am
CFP: WADT 2016 - 23rd International Workshop on Algebraic Development Techniques Link: When Sep 21, 2016 - Sep 24, 2016 Where Gregynog, UK Submission Deadline June 3, 2016 Notification June 17, 2016 Final Version Due July 1, 2016 AIMS AND SCOPE The algebraic approach to system specification encompasses many aspects of the formal design of software systems. Originally born as formal method for reasoning about abstract data types, it now covers new specification frameworks and programming paradigms (such as object-oriented, aspect-oriented, agent-oriented, logic and higher-order functional programming) as well as a wide range of application areas (including information systems, concurrent, distributed and mobile systems). The workshop will provide an opportunity to present recent and ongoing work, to meet colleagues, and to discuss new ideas and future trends. TOPICS OF INTEREST Typical, but not exclusive topics of interest are
Categories: Incoming News

CRV 2016 - The 3rd International Competition on RuntimeVerification

General haskell list - Mon, 05/09/2016 - 10:56am
CRV 2016 The 3rd International Competition on Runtime Verification In Association with COST Action “Runtime Verification beyond Monitoring” held with RV 2016, September 23-30 2016, Madrid, Spain CRV 2016 is the 3rd International Competition on Runtime Verification and will be held as part of the 16th International Conference on Runtime Verification. The event will be held in September 2016, in Madrid, Spain. CRV-2016 will draw attention to the invaluable effort of software developers and researchers who contribute in this field by providing the community with new or updated tools, libraries and frameworks for the instrumentation and runtime verification of software. The competition is a product of COST Action “Runtime Verification beyond Monitoring”, see <> for more information. Runtime Verification is a verification technique for the analysis of software at execution-time based on extracting information from a
Categories: Incoming News

[RV 2016] RV 2016, Deadlines Extended - Abstract: May 20,Paper/Tutorial: May 27

General haskell list - Mon, 05/09/2016 - 8:26am
Following several requests, the deadlines have been extended as follows: - Abstract deadline: Friday May 20 (AoE). - Paper and tutorial deadline: Friday May 27 (AoE). =============================================== RV 2016 16th International Conference on Runtime Verification September 23-30, Madrid, Spain <> Scope Runtime verification is concerned with monitoring and analysis of software and hardware system executions. Runtime verification techniques are crucial for system correctness, reliability, and robustness; they are significantly more powerful and versatile than conventional testing, and more practical than exhaustive formal verification. Runtime verification can be used prior to deployment, for testing, verification, and debugging purposes
Categories: Incoming News

Joachim Breitner: Doctoral Thesis Published

Planet Haskell - Mon, 05/09/2016 - 2:48am

I have officially published my doctoral thesis “ Lazy Evaluation: From natural semantics to a machine-checked compiler transformation” (DOI: 10.5445/IR/1000054251). The abstract of the 226 page long document that earned me a “summa cum laude” reads

In order to solve a long-standing problem with list fusion, a new compiler transformation, 'Call Arity' is developed and implemented in the Haskell compiler GHC. It is formally proven to not degrade program performance; the proof is machine-checked using the interactive theorem prover Isabelle. To that end, a formalization of Launchbury`s Natural Semantics for Lazy Evaluation is modelled in Isabelle, including a correctness and adequacy proof.

and I assembled all relevant artefacts (the thesis itself, its LaTeX-sources, the Isabelle theories, various patches against GHC, raw benchmark results, errata etc.) at

Other, less retrospective news: My paper on the Incredible Proof Machine got accepted at ITP in Nancy, and I was invited to give a keynote demo about the proof machine at LFMTP in Porto. Exciting!

Categories: Offsite Blogs