News aggregator

ANN: shine and shine-varying: Lightweight declarative 2D graphics à la gloss using GHCJS (and a FRP interface)

General haskell list - Fri, 04/22/2016 - 4:08pm
Shine wraps JavaScript’s drawing functions in a declarative API, hiding the boilerplate canvas code. The API mimics the one provided by gloss (Picture, animate, play…), but some types are different to better adapt to js code (ex. images, fonts, inputs). Example: main = runWebGUI $ \ webView -> do ctx <- fixedSizeCanvas webView 800 600 let concentricCircles = foldMap Circle [1,10..100] draw ctx concentricCircles -- one-shot drawing The only direct dependency is ghcjs-dom, so the resulting jsexe should be relatively lightweight. I also wrote shine-varying, a FRP interface to shine in terms of Vars plus some utility Vars. Example (translation of the resize-yogi Elm example): resizeImage img (x',y') = Translate (x/2) (y/2) -- Pictures are centered on (0,0), so we need to move it $ Image (Stretched x y) img -- Scale the picture to the given position where x = fromIntegral x' -- mousePosition is Integral y = fromIntegral y' main = runWebGUI $ \ webView -> d
Categories: Incoming News

Automatically Deriving Numeric Type Class Instances

haskell-cafe - Fri, 04/22/2016 - 3:23pm
Is it possible to automatically derive instances of Numeric type classes like Num, Fractional, Real, Floating, etc? I currently have two datatypes, Pair and Triple, that are defined like this: data Pair a = Pair a a data Triple a = Triple a a a I wrote these pretty trivial instances for Num and Floating: instance Num a => Num (Pair a) where (+) = liftA2 (+) (*) = liftA2 (*) abs = liftA abs negate = liftA negate signum = liftA signum fromInteger = pure . fromInteger instance Fractional a => Fractional (Pair a) where (/) = liftA2 (/) recip = liftA recip fromRational = pure . fromRational and practically identical instances for Triple as well. Is there anyway to have GHC derive these instances and the other numeric type classes? Thanks, Jake _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Haskell in Leipzig 2016: Call for Papers

General haskell list - Fri, 04/22/2016 - 12:21pm
                             Haskell in Leipzig                             September 14-15, 2016                             HTKW Leipzig, Germany                          http://hal2016.haskell.org/ == About HaL == The workshop series “Haskell in Leipzig”, now in its 11th year, brings together Haskell developers, Haskell researchers, Haskell enthusiasts and Haskell beginners to listen to talks, take part in tutorials, and join in interesting conversations. Everything related to Haskell is on topic, whether it is about current research, practical applications, interesting ideas off the beaten track, education, or art, and topics may extend to functional programming in general and its connections to other programming paradigms as well. This year, HaL is colocated with two related conferences,  * the Workshop on Functional and (Constraint) Logic Programming (WFLP) and  * the Workshop on (Co
Categories: Incoming News

Haskell in Leipzig 2016: Call for Papers

haskell-cafe - Fri, 04/22/2016 - 11:55am
                             Haskell in Leipzig                             September 14-15, 2016                             HTKW Leipzig, Germany                          http://hal2016.haskell.org/ == About HaL == The workshop series “Haskell in Leipzig”, now in its 11th year, brings together Haskell developers, Haskell researchers, Haskell enthusiasts and Haskell beginners to listen to talks, take part in tutorials, and join in interesting conversations. Everything related to Haskell is on topic, whether it is about current research, practical applications, interesting ideas off the beaten track, education, or art, and topics may extend to functional programming in general and its connections to other programming paradigms as well. This year, HaL is colocated with two related conferences,  * the Workshop on Functional and (Constraint) Logic Programming (WFLP) and  * the Workshop on (C
Categories: Offsite Discussion

I have a question about Haskell

haskell-cafe - Fri, 04/22/2016 - 4:13am
Hi i have a problem in my code! here is my code: here is error message: in very bottom function (polyEvaluate), why is not working “result <- map (\(a,b) -> a+b) powers” ??? in Prelude, it is working Thanks!_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

ANN: New Haskell.org committee members

General haskell list - Thu, 04/21/2016 - 8:43pm
The Haskell.org committee has selected its new member following the March self-nomination period. The new (returning) member is: * Gershom Bazerman Thank you to everyone who submitted a self-nomination. Note that if you have self-nominated in the past, but not been picked, please self-nominate again in the future.
Categories: Incoming News

[RV 2016] RV 2016, Sept 23-30 2016, Madrid,Spain - 3rd CFP

General haskell list - Thu, 04/21/2016 - 1:26pm
RV 2016 16th International Conference on Runtime Verification September 23-30, Madrid, Spain http://rv2016.imag.fr <https://urldefense.proofpoint.com/v2/url?u=http-3A__rv2016.imag.fr&d=BQMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=6AsiS3HGCiiWbQayKR6NFGJTSnU8_M6_CIkQI2NdBtE&m=82hYGGGDEux2KhgphuqIj7RFX2AOXREa86oSYDTT2BE&s=oBZMLSt69qPHnIrDOKsM7YhIH4Sw92LmOgc2Il-XwdE&e=> 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, and after deployment for ensuring reliability, safety, and security and for providing fault containment and recovery as well as online system repair. Topics of interest to the conference include: - specification l
Categories: Incoming News

Philip Wadler: Pedal on Parliament

Planet Haskell - Thu, 04/21/2016 - 3:25am

Come join Pedal on Parliament! Gather in the Meadows from 11am Saturday 23 April, procession sets off at noon.

A few years ago, I took my son with me to ICFP in Copenhagen. We had a blast cycling around the city, and marvelled that there were bike paths everywhere. When I lived in Morningside, my cycle to work was along quiet roads, but even so it felt safer when I arrived on the bike path through the Meadows. Now that I live near the Cameo, I'm even happier to get off the busy road and onto a path. And I look forward to the future, because Edinburgh is a city that invests in cycling and has a plan on the table that includes a cycle path from the Meadows to the Canal, which will run past my flat.

Getting more people cycling will cut pollution, benefit health, and increase quality of life. Studies show that people don't cycle because they feel sharing the road with cars is unsafe, so investment in cycle paths can make a huge difference. If people in the UK cycled and walked as much as people do in Copenhagen, the NHS would save around £17 billion within twenty years. The video below makes the case brilliantly.

Scotland has set a goal that 10% of all travel should be by cycle or foot (the buzzword is active travel), but only spends about 2% of its budget on active travel. The City of Edinburgh has pledged to up it's active travel budget by 1% a year until it reaches 10%. Pedal on Parliament is our chance to support the positive steps in Edinburgh, and encourage the rest of the country to take action.

<iframe allowfullscreen="allowfullscreen" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/eLp4tUtdBWo/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/eLp4tUtdBWo?feature=player_embedded" width="320"></iframe>
Categories: Offsite Blogs

I've wanted a Haskell shirt for awhile

haskell-cafe - Thu, 04/21/2016 - 1:27am
Does anyone know where I can get one? Failing that, I made one to celebrate today. https://teespring.com/haskell-stay-lifted Disclaimer: I don't intend to be spammy, but I totally understand and respect if some people don't like this. I was just happy and wanted to share. Please don't hate. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Bryn Keller: Mac OS X C++ Development

Planet Haskell - Wed, 04/20/2016 - 6:00pm

I recently switched to a MacBook Pro. I have customers that use Linux and Mac, and I wanted to work in a similar environment. Also recently (a few months before the MacBook) I started working with C++ again after a long hiatus.

I had thought that the Mac, being a Unix, would be relatively close to Linux, and that things I was building for Linux would be much more likely to work there than on Windows. That might still be true, but it turns out that there are several things on Mac that are not obvious, and seriously complicate native code development compared with Linux. These are my notes on those differences and how to deal with them. Hopefully, it may be useful for other migrants to Mac as well.

Xcode

Apple includes something called Xcode. This is apparently a combination of a platform SDK, and an IDE with a user interface similar to iTunes. You have to have it, but you don’t have to use the IDE part. It must be installed from the App Store. Don’t fight it, just install it and move on.

Command line tools

You definitely want the Xcode command line tools. Run:

xcode-select --install

to install them. This will give you git as well.

Brew

There are actually two package managers for Mac OS X, MacPorts and Homebrew, and as a developer you’ll definitely need one of them. I use brew, because other people I know recommended it, and it’s been nice so far. You need it to install libraries and tools that don’t come with the Mac. Most notably gcc, cmake, and so on.

Clang and gcc

Apple ships the clang compiler with Mac OS X, so this is the considered the standard compiler for the platform. This means that some libraries (notably Qt) only support building with clang.

Some C/C++ projects assume (incorrectly) that everybody builds with gcc. For this reason (I guess), Apple did a really odd thing: they ship a gcc executable, which is actually clang in disguise:

> $ gcc clang: error: no input files

This (I guess) works sometimes, since many flags work the same in both compilers. However, it is deeply confusing and causes problems as well. For example, gcc supports OpenMP, a powerful parallel computing tool, and crucial for the work I’m doing. Recent versions of clang support it as well, but Apple’s fork of clang that ships with Macs does not. So to use OpenMP, I have to have the real gcc. This will cause other problems down the road, we’ll get to them in a bit.

You’ll want to install gcc with brew:

brew install gcc gdb

Since clang is already masquerading as gcc, the Homebrew folks came up with a workaround - the gcc package installs executables called gcc-5 and g++-5 instead of gcc and g++. I added the following in my profile to encourage build systems to use these compilers instead of clang.

export HOMEBREW_CC=gcc-5 export HOMEBREW_CXX=g++-5 export CC=gcc-5 export CXX=g++-5

Note the Homebrew-specific ones. Homebrew generally installs binary, precompiled packages rather than compiling on your machine, but you can pass --build-from-source to it to make it recompile. If you do that, it will honor the HOMEBREW_CC and HOMEBREW_CXX environment variables and use those to do the build.

I also aliased cmake to ensure that cmake uses gcc-5 and g++-5 by default as well:

alias cmake=/usr/local/bin/cmake -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX Compatibility

C++, unlike C, doesn’t specify a binary interface standard. This means that libraries that are compiled with different C++ compilers can have problems interoperating. So there’s that to consider when you use things that were compile with clang (such as anything you download using brew without recompiling) together with things you’ve been building with g++-5.

The most pressing example of this is related to the C++ standard library. There are, on Mac (and elsewhere too I suppose), at least two implementations: libstdc++, and libc++. By default, clang uses libc++ and gcc-5 uses libstdc++. In practice, this means that if you install a C++ based library with brew, you will be able to compile against it with g++-5, but when you get to the link stage, it will fail with lots of missing symbols. If this happens,

brew reinstall --build-from-source <package>

can often fix the problem. However, there are brew packages (e.g. pkg-config) that will fail to compile under g++-5, so there can be cases where this doesn’t work. One example: I was trying to build mxnet directly using the brew package for OpenCV support, and it failed with the aforementioned link errors. I tried to reinstall opencv with --build-from-source with brew, and it started recompiling all of opencv’s (many) dependencies, including pkg-config, which for some reason fails to compile. So in the end I had to pull opencv as well and build it manually, after which mxnet built fine too.

Next time

These were some important things to be aware of when starting to develop in C++ on Macs. In the next installment, we’ll talk about dynamic libraries, install names, and other such loveliness.

Categories: Offsite Blogs

Types for Data.Sequence pattern synonyms

libraries list - Wed, 04/20/2016 - 5:39pm
As discussed, I plan to add pattern synonyms Empty, :<|, and :|> to make working with sequences more convenient. The remaining question is what types they should have. From the Data.Sequence standpoint, the best thing would be to make them work *only* for Seq, so that the Seq type will be inferred from their use. However, modules using multiple sequence types might benefit from more flexibility, via ad hoc classes. This, however, requires that something else pin down the sequence type, and could cause more confusing error messages. I'm leaning toward the simple, monomorphic approach, but I figured I should ask here in case anyone disagrees strongly. {-# LANGUAGE PatternSynonyms, ScopedTypeVariables, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, ViewPatterns #-} module Patt where import Data.Sequence as S import Prelude as P class FastFront x xs | xs -> x where fcons :: x -> xs -> xs fviewl :: xs -> ViewLS x xs class FastRear x xs | xs -> x where fsnoc :: xs -> x -> xs fviewr :
Categories: Offsite Discussion

Functional Jobs: λ Software Engineer at Pet Partners, LLC (Full-time)

Planet Haskell - Wed, 04/20/2016 - 1:54pm

Come help us build world class software that's fundamentally changing veterinary medicine. Pet Partners, located in Saratoga Springs, NY, owns and operates veterinary hospitals across the United States and we’re growing fast! We are looking for a Software Engineer with strong coding and SQL experience. Your responsibilities will include working on our RESTful API, flash reporting pipeline, enterprise integrations, and intranet site. This position reports directly to the Chief Information Officer.

We support several different electronic medical records applications based on MS Windows and SQL Server for our practices and reporting. In addition we rely on an open source, Linux-based stack for internal development that includes Elixir and Phoenix, Postgres, and continuous integration via Team City. We have servers on premises, collocated, as well as on AWS. The ideal candidate for this position is a great developer who is also comfortable writing and optimizing SQL.

Responsibilities:

  • Contribute stories to our agile backlog, contribute to sprints, and collaborate with users to validate solutions

  • Write code against stories that relate to our internal API, flash reporting pipeline, enterprise integrations, and intranet site, including solid test coverage

  • Design and develop solutions that extend our Kofax and Microsoft Dynamics platforms

  • Contribute to the DevOps process for your code

  • Thrive in a dynamic, collaborative culture with minimal supervision. You'll be a big part of a small team and your contributions will have a major impact on Pet Partners' success.

Skills and Qualifications:

  • Experience with Elixir is desirable but not required, but you’ll need to be an expert with at least one relevant language such as Python, Java, Go, or preferably a functional language like Clojure, Haskell, Scala, Erlang, F#, or LISP

  • Significant SQL experience

  • Agile, unit testing, continuous integration, and dev/ops experience are helpful

  • Previous working experience with Git

  • Hands on experience with common data structures like XML and JSON Experience with REST API’s

Please note that this position is full time in Saratoga Springs and is not eligible for working remotely.

Get information on how to apply for this position.

Categories: Offsite Blogs

Typeclass Constraint Causing Typechecker to Fail

haskell-cafe - Wed, 04/20/2016 - 12:24am
Below I have a contrived example. Please do not take this to be real world code. f :: (Show a) => Int -> (Int -> a) -> Int -> IO a f i g x = do print i return $ g (x + i) foo :: Bool -> IO (Either [Int] [String]) foo b = do let helper = f 2 if b then Left <$> sequence (fmap (helper negate) [0,1]) else Right <$> sequence (fmap (helper show) [0,1]) The above will fail stating Example.hs:14:35: Couldn't match type ‘Int’ with ‘[Char]’ Expected type: Int -> IO String Actual type: Int -> IO Int In the first argument of ‘fmap’, namely ‘(helper show)’ In the first argument of ‘sequence’, namely ‘(fmap (helper show) [0, 1])’ Example.hs:14:42: Couldn't match type ‘[Char]’ with ‘Int’ Expected type: Int -> Int Actual type: Int -> String In the first argument of ‘helper’, namely ‘show’ In the first argument of ‘fmap’, namely ‘(helper show)’ However, if I simply change f
Categories: Offsite Discussion

ghc-mod errors in Emacs

haskell-cafe - Tue, 04/19/2016 - 10:00pm
Greetings dear Haskell community, I'm trying to use Spacemacs for Haskell development but as soon as I open a .hs file ghc-mod dumps errors: ghc-mod: <command line>: cannot satisfy -package-id base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 (use -v for more information) <command line>: cannot satisfy -package-id base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 (use -v for more information) <command line>: cannot satisfy -package-id base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 (use -v for more information) I have ghc-mod version: 5.5.0.0 compiled by GHC 7.8.4. GHC version : 7.8.4 Emacs: 24.5.1 Spacemacs: 0.105.18 OS: Ubuntu 14.04.4 LTS Any help is appreciated, Djordje Grbic _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Mark Jason Dominus: The sage and the seven horses

Planet Haskell - Tue, 04/19/2016 - 8:11pm

A classic puzzle of mathematics goes like this:

A father dies and his will states that his elder daughter should receive half his horses, the son should receive one-quarter of the horses, and the younger daughter should receive one-eighth of the horses. Unfortunately, there are seven horses. The siblings are arguing about how to divide the seven horses when a passing sage hears them. The siblings beg the sage for help. The sage donates his own horse to the estate, which now has eight. It is now easy to portion out the half, quarter, and eighth shares, and having done so, the sage's horse is unaccounted for. The three heirs return the surplus horse to the sage, who rides off, leaving the matter settled fairly.

(The puzzle is, what just happened?)

It's not hard to come up with variations on this. For example, picking three fractions at random, suppose the will says that the eldest child receives half the horses, the middle child receives one-fifth, and the youngest receives one-seventh. But the estate has only 59 horses and an argument ensues. All that is required for the sage to solve the problem is to lend the estate eleven horses. There are now 70, and after taking out the three bequests, horses remain and the estate settles its debt to the sage.

But here's a variation I've never seen before. This time there are 13 horses and the will says that the three children should receive shares of and . respectively. Now the problem seems impossible, because . But the sage is equal to the challenge! She leaps into the saddle of one of the horses and rides out of sight before the astonished heirs can react. After a day of searching the heirs write off the lost horse and proceed with executing the will. There are now only 12 horses, and the eldest takes half, or six, while the middle sibling takes one-third, or 4. The youngest heir should get three, but only two remain. She has just opened her mouth to complain at her unfair treatment when the sage rides up from nowhere and hands her the reins to her last horse.

Categories: Offsite Blogs

[ANN] Stratosphere: AWS CloudFormation EDSL inHaskell

haskell-cafe - Tue, 04/19/2016 - 7:56pm
Github: https://github.com/frontrowed/stratosphere Hackage: https://hackage.haskell.org/package/stratosphere CloudFormation is a system that provisions and updates Amazon Web Services (AWS) resources based on declarative templates. Common criticisms of CloudFormation include the use of JSON as the template language and limited error-checking, often only available in the form of run-time errors and stack rollbacks. By wrapping templates in Haskell, we are able to easily construct them and help ensure correctness. The goals of stratosphere are to: - Build a Haskell EDSL to specify CloudFormation templates. Since it is embedded in Haskell, it is type-checked and generally much easier to work with than raw JSON. - Have a simple checking/linting system outside of the types that can find common errors in templates. - Be able to also read valid CloudFormation JSON templates so they can be type-checked. This also gives us free integration tests by using the huge amount of example templates available in t
Categories: Offsite Discussion

Functional Art, Music,Modelling and Design 2016: 2nd Call For Papers

General haskell list - Tue, 04/19/2016 - 3:30pm
4th ACM SIGPLAN International Workshop on Functional Art, Music, Modelling and Design Co-located with ICFP Nara, Japan, 24 September, 2016 Call for Papers and Demos The ACM SIGPLAN International Workshop on Functional Art, Music, Modelling and Design (FARM) gathers together people who are harnessing functional techniques in the pursuit of creativity and expression. Functional Programming has emerged as a mainstream software development paradigm, and its artistic and creative use is booming. A growing number of software toolkits, frameworks and environments for art, music and design now employ functional programming languages and techniques. FARM is a forum for exploration and critical evaluation of these developments, for example to consider potential benefits of greater consistency, tersity, and closer mapping to a problem domain. FARM encourages submissions from across art, craft and design, including textiles, visual art, music, 3D sculpture, animation, GUIs, video games, 3D printing and architectura
Categories: Incoming News

Neil Mitchell: New Shake with better wildcard patterns

Planet Haskell - Tue, 04/19/2016 - 1:01pm

Summary: The new version of Shake supports ** patterns for directory wildcards.

I've just released Shake 0.15.6. Don't be mislead by the 0.0.1 increment of the release, it's got over 50 entries in the changelog since the last release. There are quite a few bug fixes, documentation improvements and optimisations.

One of the most user visible features is the new wildcard patterns. In the previous version Shake supported // for matching any number of directories and * for matching within a path component, so to match all C source files in src you could write:

src//*.c

In the new version of Shake you can also write:

src/**/*.c

The // patterns remain supported, but I intend to encourage use of ** in new code if these patterns don't end up having any unforeseen problems. The advantages of the patterns in the new version are:

  • The ** patterns seem to be the defacto standard nowadays, being used by rsync, Ant, Gradle, Jenkins etc.
  • People would often write "src" </> "//*.c", which gives the unexpected result of //*.c. With ** you aren't overloading directories at the same time so everything works out as expected.
  • ** patterns only match relative files, not absolute ones, which is what you usually want in a build system. If you want to match absolute files use */**.
  • The semantics of patterns were a bit confusing for things like /// - I've now given them precise semantics, but ** avoids this confusion.
  • I've optimised the pattern matching for both flavours, so there is more precomputation and less backtracking (in practice I don't think that makes any difference).
  • I've optimised directory traversal using a file pattern, so it doesn't list directories that can't possibly match, which gives a significant speedup.

For this release I've also improved the website at shakebuild.com with more documentation - hopefully it is useful.

Categories: Offsite Blogs

Mark Jason Dominus: Thackeray's illustrations for Vanity Fair

Planet Haskell - Tue, 04/19/2016 - 9:37am

Last month I finished reading Thackeray’s novel Vanity Fair. (Related blog post.) Thackeray originally did illustrations for the novel, but my edition did not have them. When I went to find them online, I was disappointed: they were hard to find and the few I did find were poor quality and low resolution.

Before
After

(click to enlarge)

The illustrations are narratively important. Jos Osborne dies suspiciously; the text implies that Becky has something to do with it. Thackeray's caption for the accompanying illustration is “Becky’s Second Appearance in the Character of Clytemnestra”. Thackeray’s depiction of Miss Swartz, who is mixed-race, may be of interest to scholars.

I bought a worn-out copy of Vanity Fair that did have the illustrations and scanned them. These illustrations, originally made around 1848 by William Makepeace Thackeray, are in the public domain. In the printing I have (George Routeledge and Sons, New York, 1886) the illustrations were 9½cm × 12½ cm. I have scanned them at 600 dpi.

Large thumbails

(ZIP file .tgz file)

Unfortunately, I was only able to find Thackeray’s full-page illustrations. He also did some spot illustrations, chapter capitals, and so forth, which I have not been able to locate.

Share and enjoy.

Categories: Offsite Blogs

diffs on HaskellWiki

haskell-cafe - Tue, 04/19/2016 - 2:18am
I've noticed that when viewing changes on HaskellWiki, the diffs are missing. We had a similar problem on the OpenSSL wiki (which, like HaskellWiki, is based on MediaWiki), and the sysadmin said he fixed the problem by switching from the external diff engine to the internal diff engine. Is there someone who could look into this and possibly make that change to the wiki's configuration? I looked around the HaskellWiki and couldn't find any mention of how to contact a maintainer. Thanks, --Patrick
Categories: Offsite Discussion