News aggregator

Could someone explain this function to me?

Haskell on Reddit - Sun, 08/17/2014 - 1:37pm

Hey guys, I'm a bit of a novice to Haskell, and I found this function that calculates all the possible subsets from a set, and was wondering if someone could explain to me how it works exactly?

Here's the function:

partitions :: [a] -> [([a], [a])] partitions [] = [([], [])] partitions (x : xs) = let parts = partitions xs in [(x : ys, zs) | (ys, zs) <- parts] ++ [(ys, x : zs) | (ys, zs) <- parts]

Thanks in advance

submitted by HaskellNoob1
[link] [5 comments]
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 http://lpaste.net/6148884045213204480 Anyone have an idea what I’m doing wrong? Kind Regards, Tamar_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
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

Cabal Yesod Tutorial Dependency Problems

Haskell on Reddit - Sun, 08/17/2014 - 10:29am

Hello Everyone,

I'm a web developer by day and I am learning Haskell slowly on the side for fun, so this weekend I decided it might be fun to try to run through the Yesod tutorial.

However, I keep running into heavy dependency problems. I tried it first on OSX, in fact, but Cabal couldn't install an application called conduit. After reading that it could be because the GCC that comes with XCode is so old, I updated that and ran into new unspecified errors and it still wouldn't install.

Okay, I said, I'll try to install it on a linux VM that I have running.

And I made it about two lines further into the tutorial and ran into new dependency errors, except that these I figured I should actually ask about, so here we go:

I did the following:

cabal sandbox init cabal install --enable-tests . yesod-platform yesod-bin --max-backjumps=-1 --reorder-goals

And I received the following message:

Resolving dependencies... cabal: Could not resolve dependencies: trying: yosog-0.0.0 (user goal) rejecting: yosog-0.0.0:!test (global constraint requires opposite flag selection) trying: yosog-0.0.0:*test next goal: fast-logger (dependency of yosog-0.0.0) rejecting: fast-logger-2.2.0 (conflict: yosog => fast-logger>=2.1.4 && <2.2) trying: fast-logger-2.1.5 trying: blaze-builder-0.3.3.2 (dependency of fast-logger-2.1.5) trying: hspec-1.11.3 (dependency of yosog-0.0.0:*test) next goal: yesod-platform (user goal) rejecting: yesod-platform-1.2.13.1, 1.2.13 (conflict: fast-logger==2.1.5, yesod-platform => fast-logger==2.2.0) rejecting: yesod-platform-1.2.12.4, 1.2.12.3, 1.2.12.2, 1.2.12.1, 1.2.12, 1.2.11 (conflict: hspec==1.11.3, yesod-platform => hspec==1.9.5) rejecting: yesod-platform-1.2.10 (conflict: hspec==1.11.3, yesod-platform => hspec==1.9.2) rejecting: yesod-platform-1.2.9.3, 1.2.9.1 (conflict: hspec==1.11.3, yesod-platform => hspec==1.9.1) rejecting: yesod-platform-1.2.9, 1.2.8.2 (conflict: hspec==1.11.3, yesod-platform => hspec==1.9.0) rejecting: yesod-platform-1.2.8.1 (conflict: hspec==1.11.3, yesod-platform => hspec==1.8.4) rejecting: yesod-platform-1.2.8, 1.2.7.2, 1.2.7.1, 1.2.7 (conflict: hspec==1.11.3, yesod-platform => hspec==1.8.3) rejecting: yesod-platform-1.2.6.1, 1.2.6 (conflict: fast-logger==2.1.5, yesod-platform => fast-logger==2.1.4) rejecting: yesod-platform-1.2.5.3 (conflict: fast-logger==2.1.5, yesod-platform => fast-logger==2.1.0) rejecting: yesod-platform-1.2.5.2, 1.2.5.1, 1.2.5 (conflict: fast-logger==2.1.5, yesod-platform => fast-logger==2.0.0) rejecting: yesod-platform-1.2.4.4, 1.2.4.3, 1.2.4.2, 1.2.4.1, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0.1, 1.2.0, 1.1.9.2, 1.1.9.1, 1.1.9 (conflict: blaze-builder==0.3.3.2, yesod-platform => blaze-builder==0.3.1.1) rejecting: yesod-platform-1.1.8, 1.1.7.2, 1.1.7.1, 1.1.7, 1.1.6.1, 1.1.6, 1.1.5, 1.1.4.1, 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1.0, 1.0.6.1, 1.0.6, 1.0.5, 1.0.4.2, 1.0.4.1, 1.0.4, 1.0.3.4, 1.0.3.3, 1.0.3.2, 1.0.2, 1.0.1, 1.0.0, 0.10.3, 0.10.2 (conflict: blaze-builder==0.3.3.2, yesod-platform => blaze-builder==0.3.1.0) Backjump limit reached (change with --max-backjumps). Note: when using a sandbox, all packages are required to have consistent dependencies. Try reinstalling/unregistering the offending packages or recreating the sandbox

I just created the sandbox, so I can't imagine how that will help me. How do I "unregiser" the offending the packages? Am I really supposed to weave through all of these and figure out which package-versions depend on which other package-versions and make sure I have a carefully tuned list with no conflicting stuff (because, if so, that would be eerily reminiscent of my early Linux days. Matter of fact, this whole experience has been quote nostalgia-inducing of a thing I used to know of as "dependency hell.").

edit :

I followed /u/CKoenig 's suggestion and I'm off and running:

cabal sandbox init --sandbox=. cabal install yesod-platform cabal instal yesod-bin submitted by erewok
[link] [11 comments]
Categories: Incoming News

Don Stewart (dons): Haskell development job at Standard Chartered

Planet Haskell - Sun, 08/17/2014 - 7:07am

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 APIs to external systems such as databases, web services, pub/sub platforms is very desirable. We like working code, so if you have Hackage or github libraries, we want to see them. We also like StackOverflow answers, blog posts, academic papers, or other arenas where you can show broad FP ability.

The role requires physical presence on the trading floor in London. Remote work isn’t an option. Ideally you have some project and client management skills — you will talk to users, understand their problems, and then implement and deliver what they really need. No financial background is required.

More info about our development process is in the 2012 PADL keynote, and a 2013 HaskellCast interview.

If this sounds exciting to you, please send CVs to me – dons00 at gmail.com


Tagged: community, jobs, london
Categories: Offsite Blogs

Is there an easy way to check if two RealFloats are adjacent?

Haskell on Reddit - Sun, 08/17/2014 - 6:16am

Two floating point numbers are adjacent if there is no representable number strictly between them.

In C, you could just interpret the number as an integer and see if one is the successor of the other. (Although this only works when both floats have the same sign, and IEEE is used).

Is there a nice way to write such a check in haskell, that will work for any instance of RealFloat?

submitted by sebzim4500
[link] [14 comments]
Categories: Incoming News

Embedding a Haskell Interpreter in a Haskell app

Haskell on Reddit - Sun, 08/17/2014 - 4:12am

Hi say you wanted to embed a scripting language into a Haskell app but you want the scripting language to be Haskell. You can achieve this some what using the ghc api to write your own ghci like interpreter but is there a way to expose a subset of the host app's functions to the embedded interpreter so scripts can can make calls into the app?

submitted by snk_kid
[link] [25 comments]
Categories: Incoming News

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): http://learnyouahaskell.com/making-our-own-types-and-typeclasses "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

Noam Lewis: xml-to-json – new version released, constant memory usage

Planet Haskell - Sat, 08/16/2014 - 1:27pm

I’ve released a new version (1.0.0) of xml-to-json, which aims to solve memory issues encountered when converting large XML files. The new version includes two executables: the regular (aka “classic”) version, xml-to-json, which includes the various features, and the newly added executable xml-to-json-fast, which runs with constant memory usage and can process files of arbitrary size. It does this by not validating the input xml, and by basically streaming json output as it encounters xml elements (tags) in the input. The implementation takes advantage of the cool tagsoup library for processing XML.

Check the README.md for more details. Hackage is updated.


Tagged: Haskell
Categories: Offsite Blogs

GHC panic!

haskell-cafe - Sat, 08/16/2014 - 8:41am
I am asking for help I am Haskeller of Japan I'm using GHC7.6.3 GHC has caused the panic https://gist.github.com/minamiyama1994/6697c3fb9c345da6715f _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion