News aggregator

Haskell Weekly News: Issue 302

General haskell list - Thu, 08/21/2014 - 5:20am
Welcome to issue 302 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from August 3 to 16, 2014 Quotes of the Week * alpha123: I don't think I have the gonads for monads. :( * edwardk: There is nothing Natural about a Word. * bernalex: I very often have to deal with people who think I'm pretentious for caring about what programming language I use. "it's just programming". lol. sopvop: I used to think the same sopvop: Then haskell corrupted me sopvop: Haskell is a ghetto Top Reddit Stories * ಠ_ಠ :: String -> a Domain:, Score: 122, Comments: 56 Original: [1] On Reddit: [2] * An inspiring Haskell story: the green screen of FP Domain:, Score: 120, Comments: 13 Original: [3] On Reddit: [4] * Haskell Platform 2014.2.0.0 is released Doma
Categories: Incoming News

Vector sort poor performance

haskell-cafe - Thu, 08/21/2014 - 1:24am
Hi! I've got dramatically low sort performamce: about 2 us of time and 5 kB of allocation for unpacked vector of 4 (four) Double. Code: import Data.List import Control.Monad import Control.Monad.ST import qualified Data.Vector.Unboxed as V import qualified Data.Vector.Unboxed.Mutable as MV import qualified Data.Vector.Algorithms.Intro as Intro import Data.IORef arr = V.fromList ([1,2] :: [Double]) foo x = V.head q where q = runST $ do res <- V.unsafeThaw $ V.concat [ (\e -> e + x) arr , (\e -> e - x) arr] Intro.sort res V.unsafeFreeze res main = do ref <- newIORef 0 forM_ [0..100000] $! \i -> do modifyIORef' ref (+(foo $ fromInteger i)) -- for foo not to optimize out readIORef ref >>= print ghc -O2 sort.hs && time ./sort [1 of 1] Compiling Main ( sort.hs, sort.o ) Linking sort ... -4.999949999e9 real 0m0.189s user 0m0.184s sys 0m0.000s Does anybody know what's going
Categories: Offsite Discussion

ghc-mod v5.0.0

haskell-cafe - Wed, 08/20/2014 - 8:29am
Hi cafe, We are happy to announce that ghc-mod v5.0.0 has been released. Highlights of this version is as follows: - ghc-mod v4.x.y is suffering from the space leak of GHC 7.8.x(*1). So, ghc-modi consumes huge memory. ghc-modi v5.0.0 consumes much less memory thanks to workaround. - Alejandro Serrano merges his results of Google Summer of Code. He implements case splitting and sophisticated type hole handling. I believe that he will write an article on his results but I also updated the manual of Emacs fronted. (*2) - Daniel Gröber brushed up the internal code by bringing the GhcMod monad. So, the API of ghc-mod drastically changed. If you are users of the ghc-mod library, you should check its document. The main purpose of this release is to show the results of GSoC to everyone. This is a snapshot release and its API would change in the future. I thank two guys above since they worked hard and did good jobs. We hope that everyone enjoys v5.0.0. (*1)
Categories: Offsite Discussion

Does GHC compare pointers when eval'ing (==)

haskell-cafe - Wed, 08/20/2014 - 7:52am
Comparing two structures for equality (structurally) can be expensive. But if their references are the same they would for sure be equal (unless (==) was defined in some funny way). Does GHC perform any such optimization? (Likely a question for another list but I make a stab here first. ) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Locking of threads in one OS thread

haskell-cafe - Tue, 08/19/2014 - 10:36pm
Hello Cafe, I'm using FFI to interact with a library which calls, when fail, leave the reason in some kind of "errno"-like variable which is retrived via another call. AFAIU, this is not thread-safe in Haskell even if thread-local storage is used inside the library, because Haskell uses its own thread management and the Haskell thread in the same OS thread might be switched between the actual call and the retrival of errno value. This should be somehow handled already in Haskell (errno is widely used with syscalls in Linux, for example), but the source of Foreign.C.Error suggests that this is not handled in any way at all. For example, throwErrnoIf is implemented as such: throwErrno loc = do errno <- getErrno ioError (errnoToIOError loc errno Nothing Nothing) throwErrnoIf pred loc f = do res <- f if pred res then throwErrno loc else return res So, the question is: how is it ensured that this block is "atomic" in sense that at most one Haskell thread computes this whole function at every
Categories: Offsite Discussion

Reducing CPU load when using Helm

haskell-cafe - Tue, 08/19/2014 - 7:08pm
Forwarding this to haskell-cafe as it failed before. On 18 August 2014 20:24, Kaspar Emanuel <kaspar.bumke< at >> wrote:
Categories: Offsite Discussion

Proposal: Add forkOSUnmasked to Control.Concurrent

libraries list - Tue, 08/19/2014 - 1:24pm
Joey Adams wrote a request a year or so ago to add forkOSUnmasked to Control.Concurrent
Categories: Offsite Discussion

Is there something for emacs to view project modulestructure?

haskell-cafe - Tue, 08/19/2014 - 10:20am
Hi, I think a structure viewing in editor could be very help for long file or big project. Something like java/c# IDEs do. But I could not find a hint on google. Any suggestions?
Categories: Offsite Discussion

[ANN] extended-categories

haskell-cafe - Tue, 08/19/2014 - 8:36am
extended-categories <> is an implementation of categories designed to make use of GHC's recently enriched kind system. This project is a work in progress (only a few basic constructs are implemented), but your comments are welcomed. extended-categories requires a recent version of GHC (I have only tested it with 7.8.3). Categories are poly-kinded and have an Object constraint family: class Category m where type Object (m :: k -> k -> *) (a :: k) :: Constraint id :: Object m a => m a a (.) :: (Object m a, Object m b, Object m c) => m b c -> m a b -> m a c This means in addition to our usual categories of kind * -> * -> * we can define categories of other kinds, for example (:-) from the constraints package forms a category with kind Constraint -> Constraint -> * (whose instance is used in this package)! Functors are named (tagged) as done in the data-category package. This allows a much wider variety of functors to be defined. Additionally functors must pro
Categories: Offsite Discussion


libraries list - Tue, 08/19/2014 - 8:09am
David You've been doing all this work on improving fusion, and you probably have a very good idea now about how it works, and how GHC's libraries use phases and RULES to achieve it. A kind of design pattern, if you like; tips and tricks. I wonder if you'd feel able to write a GHC wiki page describing what you have learned, with examples and explanation about why it is done that way. If you did this, someone who follows in your footsteps wouldn't need to re-learn everything. And maybe someone will say "oh, there's one pattern you have omitted, here it is". Thanks Simon
Categories: Offsite Discussion

and / or

libraries list - Tue, 08/19/2014 - 7:24am
First question: how bad would it be to use the Prelude definitions of and and or? I assume if there's a problem it's probably excessive duplication by the inliner? Second question: if that would be bad, why not rewrite them to foldr forms, then write them back, like other things do? Statement: if the current arrangement really is the best, then we should add two additional rules: "and/augment" forall (g::forall b.(Bool->b->b)->b->b) (xs::[Bool]) . and (augment g xs) = g (&&) (and xs) "or/augment" forall (g::forall b.(Bool->b->b)->b->b) (xs::[Bool]) . or (augment g) = g (||) (or xs)
Categories: Offsite Discussion

Type-level numbers problem

haskell-cafe - Mon, 08/18/2014 - 8:15pm
Hi! I wrote one thing with type-level numbers that were represented as simple data Zero data Succ a Then, in order to not invent my own peano numbers, I decided to go look for ones, and found GHC.TypeLits. But unfortunately, it shows a weird error for me. Here is a piece of code: The one that's below "main" is working properly, while the one on top of it gives this error: typenats.hs:17:16: No instance for (Op D (0 + 1)) arising from a use of `f' Possible fix: add an instance declaration for (Op D (0 + 1)) In the expression: f (VJ i :: VJ D (0 + 1)) In an equation for `f': f (VJ i) = f (VJ i :: VJ D (0 + 1)) In the instance declaration for `Op D 0' Maybe I worked too much on type-level numbers today to not understand this simple error I'm getting, but could someone be so kind and explain me what am I doing wrong? Thank you very much! _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Fully funded PhD position on Computational Logic/Functional Programming/Interactive Theorem Proving, University of Dundee, Scotland

haskell-cafe - Mon, 08/18/2014 - 9:45am
One fully funded PhD position on Computational Logic/Functional Programming/Interactive Theorem Proving is available at the University of Dundee, Scotland. For more information, please email katya< at > or refer to: The funding is provided by EPSRC Doctoral Training Partnership Scheme, and is available for UK residents only. Katya Ekaterina Komendantskaya Senior Lecturer, Head of PhD Studies Room 1.04, Queen Mother Building School of Computing, University of Dundee Scotland, DD14HN Tel: (+44) 01382384820 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

CUFP 2014: Call For Participation

General haskell list - Mon, 08/18/2014 - 9:16am
****************************************************************** CALL FOR PARTICIPATION Commercial Users of Functional Programming (CUFP) 2014 at ICFP 2014; Gothenburg, Sweden, Sep 4-6. ****************************************************************** Overview ======== Functional programming has been at the forefront of a new generation of programming technologies: Companies employing functional programming use it to enable more effective, robust, and flexible software development. The annual CUFP workshop is designed to serve the growing community of commercial users of functional programming: Practitioners meet and collaborate; language designers and users can share ideas about the future of their languages; experts share their expertise on practical functional programming. CUFP 2014 begins with two days of tutorials by top-notch language experts including advanced tutorials on special topics, followed by a day of talks about industrial applications of functional programming.
Categories: Incoming News

Wish list for GHC API tooling support

haskell-cafe - Mon, 08/18/2014 - 9:06am
At the moment the GHC API is a sort of poor relation in the haskell world, where it could be a significantly useful resource for the growing list of haskell tool providers. Based on my experiences with HaRe, I have started putting together a wish list of features I would like to see in it, which is here I welcome feedback / discussion on this. Regards Alan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

[ANN] BOB 2015: Call for Contributions

General haskell list - Sun, 08/17/2014 - 8:02pm
The BOB conference will have a strong focus on functional programming, so Haskell submissions very welcome. Please consider submitting! BOB Conference 2015 Berlin 23.1.2015 CALL FOR CONTRIBUTIONS English: German: Deadline: September 30, 2014 You drive advanced software engineering methods, implement ambitious architectures and are open to cutting-edge innovation? Attend this conference, meet people that share your goals, and get to know the best software tools and technologies available today. We strive to offer you a day full of new experiences and impressions that you can use to immediately improve your daily life as a software developer. If you share our vision and want to contribute, submit a proposal for a talk or tutorial! We are lo
Categories: Incoming News

Issues with Marshalling arrays of user defined types

haskell-cafe - Sun, 08/17/2014 - 1:05pm
Hi All, I’ve been scratching my head for weeks trying to figure out what goes wrong with the code pasted below. It’s compiled to a shared library (dll) on windows. I know the Storable instance is correct because calls to testFooA works, but calls to testFooListA get an invalid pointer back. Lists of Ints do work fine, so it seems that newArray is also working. In GHCi it can dereference the pointer. And this used to work before in earlier GHC 7.0 and later 6.6 builds. Using WinDBG and gflags I see that the pointer is indeed invalid, but that the *valid* data is there in the heap. The example code can be found at Anyone have an idea what I’m doing wrong? Kind Regards, Tamar_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Haskell developer roles at Standard Chartered

haskell-cafe - Sun, 08/17/2014 - 1:02pm
Hi Cafe, The Strats team at Standard Chartered is hiring expert typed FP developers for Haskell dev roles in London. This is a "front office" finance role - meaning you will work directly with traders building software to automate and improve their efficiency. The role is very development focused, and you will use Haskell for almost all tasks: data analysis, DSLs, market data publishing, databases, web services, desktop GUIs, large parallel tasks, quantitative models, solvers, everything. There may be a small amount of C++ or F# on occasion. This is a fast paced role - code you write today will be deployed within hours to hundreds of users and has to work. You will join an expert team in London, and significant, demonstrable experience in typed FP (Haskell, OCaml, F# etc) is strongly preferred. We have more than 2 million lines of Haskell, and our own compiler. In this context we look for skill and taste in typed API design to capture and abstract over complex, messy systems. Experience writing typed API
Categories: Offsite Discussion

HsUnix.h on Ubuntu Linux

haskell-cafe - Sun, 08/17/2014 - 1:16am
1) I forgot how to get this include file 2) where does it go under /usr/include ???
Categories: Offsite Discussion

tree insert and laziness

haskell-cafe - Sat, 08/16/2014 - 10:05pm
Dear Haskell-Cafe, I'm presently reviewing a translation of the following paragraph (taken from LUaH, chapter 8): "In languages like C, we'd do this by modifying the pointers and values inside the tree. In Haskell, we can't really modify our tree, so we have to make a new sub-tree each time we decide to go left or right and in the end the insertion function returns a completely new tree, because Haskell doesn't really have a concept of pointer, just values. Hence, the type for our insertion function is going to be something like a -> Tree a - > Tree a. It takes an element and a tree and returns a new tree that has that element inside. This might seem like it's inefficient but laziness takes care of that problem." If it is really the laziness that makes this approach efficient? If it isn't, what did the author want to say in the last sentence? Thank you, Semen
Categories: Offsite Discussion