News aggregator

JP Moresmau: HGraphStorage on Hackage

Planet Haskell - Sun, 02/01/2015 - 10:18am
I've published my prototype of a graph database, HGraphStorage, on Hackage. Not to say that this is a database you should use in production! This is just a test bed to play around graph database concepts and low level algorithms for storage and retrieval.

Just releasing it was, ahem, fun, as somebody noticed that it didn't build in a clean sandbox, and then that the haddock comments were broken (it's a bit annoying that a one space error in Haddock markup causes the whole install to fail). So hopefully now it's ready for people to try and improve!

Pull requests welcome!!

Categories: Offsite Blogs

Template Haskell attempts to load mingw32.dll duringbuild

haskell-cafe - Sun, 02/01/2015 - 9:15am
Hi all, Windows GHC 7.8.4 build issue here: I've noticed that GHC will attempt to link mingw32 if a related dependency (in my case sdl2) is required in a TH pass. Unsurprisingly, the OS fails to find the imaginary mingw32.dll file. Are there any known resolutions to this quirk? Cheers, Darren _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Proposal: Add mapWithIndex to Data.List

libraries list - Sun, 02/01/2015 - 3:21am
Vectors offer `imap` and sequences offer `mapWithIndex`. I think lists deserve to have something like this too. The obvious implementation, using `zipWith`, is unlikely to be the most efficient (because foldr/build fusion doesn't handle zips so wonderfully). To a first approximation: mapWithIndex :: (Int -> a -> b) -> [a] -> [b] mapWithIndex f xs = build $ \c n -> let go x cont !i = f i x `c` cont (i+1) in foldr go (`seq` n) 0
Categories: Offsite Discussion

What are some examples of really good Haskell code?

Haskell on Reddit - Sun, 02/01/2015 - 12:17am

In order to improve my personal coding style I'd like to take the time to study exemplary Haskell. Can you recommend certain libraries or examples that are written especially clearly and idiomatically?

submitted by begriffs
[link] [27 comments]
Categories: Incoming News

Cabal config file - default install flags?

haskell-cafe - Sat, 01/31/2015 - 11:02pm
I'd like to have cabal automatically use -j8 when I cabal install something. Is there something I can put into the .cabal/config file that will accomplish this? More generally, where can I find documentation on that config file? - Lucas Paul
Categories: Offsite Discussion

Can the "read" function execute functions?

Haskell on Reddit - Sat, 01/31/2015 - 9:20pm

For example, if I have f n = n2, is there a way that I can do read "f 5" that will return 25? Is it possible to execute functions though the read function?

EDIT: Or any other function for that matter. I'm just wondering if it's possible.

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

What ever happened to 'layers` package?

Haskell on Reddit - Sat, 01/31/2015 - 3:20pm

You'll find an old discussion here:

It seems quite promising, but the hackage package is not up-to-date with the GitHub source. Is anyone actively using this?

Some context: "Monad layers, an alternative to transformers: The author claims [layers package's] superiority over transformers, but given that in my whole Haskell experience I have never heard anything about that package I am interested why, also whether the author's claims are true and in general opinions from the community."

submitted by eacameron
[link] [4 comments]
Categories: Incoming News

haskell-game/sdl2 · GitHub - Sat, 01/31/2015 - 2:33pm
Categories: Offsite Blogs

neurocyte/ghc-android · GitHub - Sat, 01/31/2015 - 2:32pm
Categories: Offsite Blogs

Simpler, Easier!

Haskell on Reddit - Sat, 01/31/2015 - 2:26pm
Categories: Incoming News

Roman Cheplyaka: Spiral similarity solves an IMO problem

Planet Haskell - Sat, 01/31/2015 - 2:00pm

While recovering from a knee surgery, I entertained myself by solving a geometry problem from the last International Mathematical Olympiad. My solution, shown below, is an example of using plane transformations (spiral similarity, in this case) to prove geometric statements.


(IMO-2014, P4)

Points \(P\) and \(Q\) lie on side \(BC\) of acute-angled triangle \(ABC\) such that \(\angle PAB=\angle BCA\) and \(\angle CAQ = \angle ABC\). Points \(M\) and \(N\) lie on lines \(AP\) and \(AQ\), respectively, such that \(P\) is the midpoint of \(AM\) and \(Q\) is the midpoint of \(AN\). Prove that the lines \(BM\) and \(CN\) intersect on the circumcircle of triangle \(ABC\).


Let \(\angle BAC = \alpha\).

\[\angle APB = \pi - \angle PAB - \angle PBA = \pi - \angle ACB - \angle CBA = \alpha\]

Let \(B_1\) and \(C_1\) be such points that \(B\) and \(C\) are midpoints of \(AB_1\) and \(AC_1\), respectively.

Consider a spiral similarity \(h\) such that \(h(B_1)=A\) and \(h(B)=C\) (it necessarily exists).

Now we shall prove that \(h(M)=N\), i.e. that \(h\) transforms the green \(\triangle B_1BM\) into the magenta \(\triangle ACN\) .

Being a spiral similarity, \(h\) rotates all lines by the same angle. It maps \(B_1B\) to \(AC\), therefore that angle equals \(\angle(B_1B, AC)=\pi-\alpha\). (We need to be careful to measure all rotations in the same direction; on my drawing it is clockwise.)

\(h(A)=C_1\), since \(h\) preserves length ratios. So \(h(AM)\) (where \(AM\) denotes the line, not the segment) is a line that passes through \(h(A)=C_1\). It also needs to be parallel to \(BC\), because \(\angle (AM,BC)=\pi-\alpha\) is the rotation angle of \(h\). \(C_1B_1\) is the unique such line (\(C_1B_1 \parallel BC\) by the midline theorem).

Since \(h(AM)=C_1B_1\) and \(h(MB_1)=NA\), \[h(M)=h(AM\cap MB_1)=h(AM)\cap h(MB_1)=C_1B_1\cap NA=N.\]

Now that we know that \(h(BM)=CN\), we can deduce that \(\angle BZC=\angle(BM,CN)=\pi-\alpha\) (the rotation angle). And because \(\angle BAC+\angle BZC=\pi\), \(Z\) lies on the circumcircle of \(ABC\).

Categories: Offsite Blogs

What are the current best practices for installing and maintaining Haskell development environment, with multiple versions of GHC, installed global packages, etc.

Haskell on Reddit - Sat, 01/31/2015 - 12:49pm

I know this question is probably here quite often, but after not having worked in Haskell for around 8 months, I've found that a lot of things have changed, and my old way of working doesn't work anymore.

I'm splitting this into multiple questions, so that it is easier to answer them.

  1. It seems that Stackage LTS is the way to go if one wants to avoid cabal hell while installing global packages (like ghc-mod, yesod-bin, hlint, etc.)?
  2. What version of cabal-install is the go-to one? Since cabal itself constantly prompts for new updates, I ended up installing 1.22.x, which turns out to be incompatible with ghc-mod on GHC 7.8 (, and now I'm feeling stuck, now knowing if I should upgrade GHC, downgrade cabal-install, or choose a completely different approach?
  3. Is there a point in using sandboxes when one uses Stackage? I used to use sandboxed for everything, but if Stackage LTS would avoid the versioning issues, are they still needed?
  4. What is the correct way of installing global packages, such as (ghc-mod, hlint, ..., or even lens)? Should I rm -rf ~/.ghc ~/.cabal, install a specific version of cabal, download stackage config and then proceed with installing everything else? Or is there a better way?
  5. What is the best way of installing GHC on OS X? There's Haskell Platform, Homebrew GHC/Cabal formulas, and Haskell for OS X. I've been told that Homebrew formulas were broken a few months ago, and that Haskell Platform is not good if you plan on doing anything but the most basic things. And now that I'm looking at versions of Cabal, it seems that Haskell for OS X uses cabal-install, while Stackage LTS locks at ... wouldn't this cause problems? One can also download the binary build of GHC and install it manually, which seemed to work quite well in the past, but it wasn't so easy to uninstall.
  6. Similar to the previous question, what is a good way of maintaining multiple GHC versions? There are versions of packages that only work under GHC 7.10, and others that don't, so it seems quite important to be able to switch with ease, without having to reinstall everything.

I'm sorry if this looks like a rant, but I just can't seem to find this kind of information written up in one place. There are snippets and guides and tutorials, and everyone is recommending something else (since there are multiple solutions), but also every time I ask on IRC or somewhere about an issue like this, it ends up being a problem in my setup and I have to reinstall a bunch of packages to get everything working again.

TL;DR: What is the best and most versatile way to install GHC, global packages and avoid reinstalling every single thing every time in a sandbox. It's not that I don't like sandboxes, but my fastest quad core machine still takes over a half an hour to build some packages, which just kills the "let's quickly start up a new project and play around" kind of work.

edit: It'd be great if we had a list of the install options, with pros&cons and recommendations when to use which one, such as "don't use Haskell Platform if you want to use bleeding edge packages, because of X", etc.

submitted by progfu
[link] [26 comments]
Categories: Incoming News

alevy/postgresql-orm - Sat, 01/31/2015 - 12:33pm
Categories: Offsite Blogs

alevy/postgresql-orm - Sat, 01/31/2015 - 12:33pm
Categories: Offsite Blogs

Линзы: Real World - Sat, 01/31/2015 - 11:43am
Categories: Offsite Blogs