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 advancesubmitted by HaskellNoob1
[link] [5 comments]
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-18.104.22.168, 1.2.13 (conflict: fast-logger==2.1.5, yesod-platform => fast-logger==2.2.0) rejecting: yesod-platform-22.214.171.124, 126.96.36.199, 188.8.131.52, 184.108.40.206, 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-220.127.116.11, 18.104.22.168 (conflict: hspec==1.11.3, yesod-platform => hspec==1.9.1) rejecting: yesod-platform-1.2.9, 22.214.171.124 (conflict: hspec==1.11.3, yesod-platform => hspec==1.9.0) rejecting: yesod-platform-126.96.36.199 (conflict: hspec==1.11.3, yesod-platform => hspec==1.8.4) rejecting: yesod-platform-1.2.8, 188.8.131.52, 184.108.40.206, 1.2.7 (conflict: hspec==1.11.3, yesod-platform => hspec==1.8.3) rejecting: yesod-platform-220.127.116.11, 1.2.6 (conflict: fast-logger==2.1.5, yesod-platform => fast-logger==2.1.4) rejecting: yesod-platform-18.104.22.168 (conflict: fast-logger==2.1.5, yesod-platform => fast-logger==2.1.0) rejecting: yesod-platform-22.214.171.124, 126.96.36.199, 1.2.5 (conflict: fast-logger==2.1.5, yesod-platform => fast-logger==2.0.0) rejecting: yesod-platform-188.8.131.52, 184.108.40.206, 220.127.116.11, 18.104.22.168, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 22.214.171.124, 1.2.0, 126.96.36.199, 188.8.131.52, 1.1.9 (conflict: blaze-builder==0.3.3.2, yesod-platform => blaze-builder==0.3.1.1) rejecting: yesod-platform-1.1.8, 184.108.40.206, 220.127.116.11, 1.1.7, 18.104.22.168, 1.1.6, 1.1.5, 22.214.171.124, 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1.0, 126.96.36.199, 1.0.6, 1.0.5, 188.8.131.52, 184.108.40.206, 1.0.4, 220.127.116.11, 18.104.22.168, 22.214.171.124, 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.").
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]
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.
If this sounds exciting to you, please send CVs to me – dons00 at gmail.com
Tagged: community, jobs, london
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]
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]
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.