News aggregator

Is there XMPP server written with haskell?

Haskell on Reddit - Fri, 05/30/2014 - 11:47pm

Hello All,

Is there XMPP server written with haskell?

Thank you.

submitted by 0xAX
[link] [comment]
Categories: Incoming News

Is anyone here using cloudhaskell or distributed-process in production?

Haskell on Reddit - Fri, 05/30/2014 - 9:24pm

I have followed distributed-process for a while now, and I'm curious to see if anyone here is using it, and for what sorts of applications. I will have an opportunity to begin a codebase from scratch, and I'm looking into the possibility of using Haskell for it. It will be running on a cluster, possibly with GPU integration. This is a scientific application, and the project director wants to see what happens to the code when non-physicists are the ones to start it.

I know that MPI and CUDA already have significant work done in this space, and I may just decide to go the C/C++ route. Has anyone here had a similar experience that they could share?

submitted by pythonista_barista
[link] [12 comments]
Categories: Incoming News

ghc-rts.pdf - Fri, 05/30/2014 - 9:08pm
Categories: Offsite Blogs

An alternative Haskell home page - Fri, 05/30/2014 - 6:44pm
Categories: Offsite Blogs

An alternative Haskell home page - Fri, 05/30/2014 - 6:44pm
Categories: Offsite Blogs

Evaluating Haskell via SMS

Haskell on Reddit - Fri, 05/30/2014 - 5:07pm
Categories: Incoming News

Eric Kidd: Deploying Rust applications to Heroku, with example code for Rustful

Planet Haskell - Fri, 05/30/2014 - 2:20pm

If you have git and the Heroku toolbelt on your system, this should be easy:

git clone cd heroku-rust-hello heroku create --buildpack git push heroku master

If you want to create your own Rust web server from scratch, keep reading. But fair warning: Rust is not yet ready for serious web development.

Read more…

Categories: Offsite Blogs

Architecture of a Real World Haskell Application II

Haskell on Reddit - Fri, 05/30/2014 - 1:15pm

Not exactly about the architecture anymore, but focuses now on the transport protocol parsing, especially on the historical evolution of it: Architecture of a Real World Haskell Application II. I am quite busy currently, so it took some time and had not so much time editing the post. So if you find errors, that's expected :)

submitted by empowerg
[link] [2 comments]
Categories: Incoming News

Prime factors of a given number using list comprehension

Haskell on Reddit - Fri, 05/30/2014 - 12:56pm

Hi, how can I find prime factors of a given number using list comprehension in Haskell? Can you help me? Thank you in advance.

submitted by shevchenko7
[link] [11 comments]
Categories: Incoming News

Pandoc: HOWTO for ePub -> PDF conversion?

Haskell on Reddit - Fri, 05/30/2014 - 11:32am

I'm looking for a handy way to convert an EPUB format document to something else. The immediate goal is PDF (sadly: PDF readers on Linux are superior to ePub readers), but others might also be considered. Hrm.... Actually, LaTeX would solve most of my problems....

I'm only partially familar with EPUB formats, and virtually not at all with Haskell.

I've unzipped the epub and have my document tree:

. ├── META-INF └── OEBPS ├── css ├── fonts └── images

What I'm looking for is a convenient way to arrange the contents such that they're output in the form of the book I'd like. This comprises a bunch of chapters, several parts, and front- and end-matter, as well as images. Slightly more than are convenient to hand-edit.

There's a package.ocf file which is the manifest. Parsing that properly would work for me. Are there tools which provide for this?

And if there's a better place on reddit for pandoc questions, please say.



Not fully converted, but I'm pretty much there.

I used a shell loop and pandoc to create LaTeX files for each HTML source from the exploded ePub tree.

I used a LaTeX book template to modify the package.ocf file using \include{} statements to recreate the document structure.

pdflatex works on that to output PDF (including not complaining about JPEG image sizes as latex itself did).

I've had to fix up a few bits of the LaTeX, including changing the subscript encoding and including a few additional LaTeX packages to make everything tidy. Section naming was a bit wonky and I've fixed that ... except for some end-mater materials. I need to figure out how to include the cover image as an actual cover. And probably (re)-generate an index.

But I've got 526 pages of very nicely laid out text.

submitted by dredmorbius
[link] [6 comments]
Categories: Incoming News

What is a good, achievable project (weekend project) in haskell that will teach me good functional practices as well as some cool haskell tricks?

Haskell on Reddit - Fri, 05/30/2014 - 10:18am

I'm not really looking for a tutorial or something that's going to hold my hand. I'm looking for a project that I can sink my teeth into and struggle with in order to better know the language as well as functional programming.

submitted by billofalltrades
[link] [45 comments]
Categories: Incoming News

Eric Kidd: Installing Rust nightly builds on Ubuntu 10.04 Lucid

Planet Haskell - Fri, 05/30/2014 - 8:53am

Rust is a systems programming language designed around speed and safety. It sits roughly halfway between Go and Haskell. In particular, it combines precise, safe control over memory with high-level functional programming. Haskell programmers, for example, will notice that Rust's and_then works much like bind in Haskell's Maybe monad:

use std::os::getenv; use std::io::net::ip::Port; /// Look up our server port number in PORT. fn get_server_port() -> Port { getenv("PORT") .and_then(|s| from_str::<Port>(s.as_slice())) .unwrap_or(8080) }

Anyway, I spent this morning trying to get Rust working on Ubuntu 10.04 Lucid, as part of a larger effort to deploy a Rust application on Heroku. (More on that soon.) On Ubuntu 10.04, rustc fails looking for

Read more…

Categories: Offsite Blogs

ghc-rts.pdf - Fri, 05/30/2014 - 8:14am
Categories: Offsite Blogs

An alternative Haskell home page - Fri, 05/30/2014 - 7:36am
Categories: Offsite Blogs

Yesod Web Framework: Exceptions in continuation-based monads

Planet Haskell - Thu, 05/29/2014 - 8:43pm

I've been meaning to write a blog post for a few weeks now about exception handling in Haskell, especially with regards to monad transformer stacks. Unfortunately, this is not that blog post, just one small aspect of it: exception handling in continuation-base monads.

I've seen many people at different times advocate having some kind of exception handling in continuation-based monads. Without calling out individual instances, I'll sum up a lot of what I've discussed as, "Why can't conduit/enumerator/pipes have a bracket function?"

After noticing yet another request for such a thing this morning, I decided to write up a quick demonstration of what happens when you create a bracket function for the enumerator package. I'll be using MonadCatchIO-transformers (which is thankfully deprecated in favor of the exceptions package), and snap-core's orphan instance.

Let's start off by noticing something interesting: enumerator provides an enumFile function (for reading the contents of a file), but no iterFile equivalent to write data back. Using a bracket, it's actually really easy to write up such a function (including some debug output to make sure we're being safe):

iterFile :: (MonadCatchIO m, MonadIO m, Functor m) => FilePath -> Iteratee ByteString m () iterFile fp = bracket (liftIO $ do putStrLn $ "opening file for writing: " ++ fp IO.openFile fp IO.WriteMode) (\h -> liftIO $ do putStrLn $ "closing file for writing: " ++ fp IO.hClose h) iterHandle

There shouldn't be any surprises in this implementation: we open a file handle in the acquire argument, close that handle in the release argument, and then use the handle in the inner argument. All is well in the world. Now let's try actually using this function, both with and without exceptions being thrown:

main :: IO () main = do writeFile "exists.txt" "this file exists" run (enumFile "exists.txt" $$ iterFile "output1.txt") >>= print run (enumFile "does-not-exist.txt" $$ iterFile "output2.txt") >>= print

Or you can try running the code yourself. Let's look at the output:

opening file for writing: output1.txt closing file for writing: output1.txt Right () opening file for writing: output2.txt Left does-not-exist.txt: openBinaryFile: does not exist (No such file or directory)

Notice that the output2.txt Handle is never closed. This is inherent to working with any continuation based monad, since there are no guarantees that the continuation will be called at all. It's also impossible to know if your continuation will be called only once. With something like ContT, it's possible to have the continuation run multiple times, in which case your cleanup actions can run multiple times, which can be really bad.

The exceptions package handles this in the right way. There are two different type classes: MonadCatch allows for catching exceptions (which a continuation based monad does allow for), whereas MonadMask gives guarantees about bracket/finally semantics, which is what a continuation-based monad cannot do. Another valid approach is monad-control, which makes it (I believe) impossible to write invalid instances.

(I want to get into more of the details of the trade-offs between exceptions and monad-control, but that will have to wait for another blog post. For now, I just wanted to address immediate continuation based concern.)

If you're in a continuation based monad and you need exception safe resource handling, there is a solution: resourcet. resourcet hoists the exception safety outside of the realm of the continuation based code, and maintainers finalizer functions via mutable variables. Note that this isn't just useful for continuation based monads, but for any situation where you don't have full control over the flow of execution of the program. For example, you'd use the same technique for an io-streams directory traversal.

One last caveat. There is one case where a continuation based monad could in theory have a valid bracket function, which is where you have full knowledge of the code which will run the continuation, and can guarantee that all continuations will always be executed. So if you hide constructors and only expose such run functions, you might be safe. But the burden of proof is on you.

Note: I'm purposely not linking to any of the conversations I've referred to about getting a bracket function for continuation based monads, I don't feel like calling people out here. Also, in case you don't feel like loading up the School of Haskell page, here's the full source code for my example above:

{-# LANGUAGE PackageImports #-} import "MonadCatchIO-transformers" Control.Monad.CatchIO (MonadCatchIO, bracket) import Control.Monad.IO.Class (MonadIO, liftIO) import Data.ByteString (ByteString, hPut) import Data.Enumerator (Iteratee, run, ($$)) import Data.Enumerator.Binary (enumFile, iterHandle) import Snap.Iteratee () -- orphan instance import qualified System.IO as IO iterFile :: (MonadCatchIO m, MonadIO m, Functor m) => FilePath -> Iteratee ByteString m () iterFile fp = bracket (liftIO $ do putStrLn $ "opening file for writing: " ++ fp IO.openFile fp IO.WriteMode) (\h -> liftIO $ do putStrLn $ "closing file for writing: " ++ fp IO.hClose h) iterHandle main :: IO () main = do writeFile "exists.txt" "this file exists" run (enumFile "exists.txt" $$ iterFile "output1.txt") >>= print run (enumFile "does-not-exist.txt" $$ iterFile "output2.txt") >>= print
Categories: Offsite Blogs

New gtk2hs 0.12.4 release

gtk2hs - Wed, 11/21/2012 - 12:56pm

Thanks to John Lato and Duncan Coutts for the latest bugfix release! The latest packages should be buildable on GHC 7.6, and the cairo package should behave a bit nicer in ghci on Windows. Thanks to all!


Categories: Incoming News