News aggregator

Deploying Haskell (standalone, yesod, snap…) in Openshift fails

Haskell on Reddit - Sun, 08/09/2015 - 9:24am

I'm posting this in /r/haskell because I didn't get any responses in /r/haskellquestions. Is this an error on my end, or is it something known?

Whenever I try to create an application based on the Haskell cartridge, it results in the a variant of the following error:

The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 55c67c940c1e6694ac000017 -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c5,c753' /bin/sh -c \"gear postreceive --init >> /tmp/initial-build.log 2>&1\""' returned an error. rc=137 .Last 10 kB of build output: The server is not running, nothing to stop. Repairing links for 1 deployments Building git ref 'master', commit 6b8beb4 Downloading the latest package list from

This happens for predefined cartridges in the Openshift hub, such as Snap, Yesod, Scotty, and for the cartridges defined in the wiki (

I'm requesting help because he application never gets created thus I can't check the logs, and I can't make much from the error message. I tried other cartridge types than Haskell, and they get created just fine.

submitted by Skyeam
[link] [7 comments]
Categories: Incoming News

A brain-teaser: optimize the Applicative instance

Haskell on Reddit - Sun, 08/09/2015 - 4:11am

So here's a little brain-teaser for you guys. I managed to write the following Applicative instance and to my astonishment it actually compiles. :) I'm still struggling to get a less roundabout intuition into it, though. So if anyone dares to write a clearer version of it, please do.

-- | -- A thing that executes an effectful handler. newtype Executor m a = Executor (forall z. (a -> m z) -> m z) instance Functor (Executor m) where fmap aToB (Executor a'') = Executor $ \b' -> a'' (b' . aToB) instance Applicative (Executor m) where pure a = Executor $ \a' -> a' a (<*>) (Executor aToB'') (Executor a'') = Executor $ \b' -> ($ id) $ flip (premap . premap) aToB'' $ \aToB -> ($ id) $ flip (premap . premap) a'' $ \a -> b' $ aToB a where premap = flip (.) submitted by nikita-volkov
[link] [20 comments]
Categories: Incoming News

Mark Jason Dominus: A message to the aliens, part 0/23 (framing)

Planet Haskell - Sun, 08/09/2015 - 3:33am

Earlier articles: Introduction

(At left is page 1 of the Cosmic Call message. For an enlarged version of the image, click it.)

First, some notes about the general format of each page. The Cosmic Call message was structured as 23 pages, each a 127×127 bitmap. The entire message was therefore 127×127×23 bits, and this would hopefully be suggestive to the aliens: they could try decoding it as 127 pages of 127×23-bit images, which would produce garbage, or as 23 pages of 127×127-bit images, which is correct. Or they might try decoding it as a single 127×2921-bit image, which would also work. But the choices are quite limited and it shouldn't take long to figure out which one makes sense.

To assist in the framing, each page of the message is surrounded by a border of black pixels and then a second smaller border of white pixels. If the recipient misinterpreted the framing of the bit sequence, say by supposing that the message was made of lines of 23 pixels, it would be immediately apparent that something was wrong, as at right. At the very least the regular appearance of the black border pixels every 127 positions, and the fact that the message began with 128 black pixels, would suggest that there was something significant about that number. If the aliens fourier-transform the message, there should be a nice big spike at the 127 mark.

Most of the message is encoded as a series of 5×7-pixel glyphs. The glyphs were generated at random and then subject to later filtering: candidate glyphs were discarded if they don't differ from previous glyphs in enough bit positions. This is to help the recipients reconstruct the glyphs if some of the bits are corrupted in transmission, as is likely.

The experimenters then eyeballed the glyphs and tried to match glyphs with their meanings in a way that would be easy for humans to remember, to aid in proofreading. For example, the glyph they chose to represent the digit 7 was .

People frequently ask why the message uses strange glyphs instead of standard hindu-arabic numerals. This is explained by the need to have the glyphs be as different as possible. Communication with other stars is very lossy. Imagine trying to see a tiny flickering light against the background of a star at a disatnce of several light years. In between you and the flickering light arevariable dist and gas clouds. Many of the pixels are likely to be corrupted in transmission. The message needs to survive this corruption. So glyphs are 35 bits each. Each one differs from the other glyphs in many positions, whereas a change of only a few pixels could change a standard 6 into an 8 or vice versa. A glyph is spread across multiple lines of the image, which makes it more resistant to burst errors: even if an entire line of pixels is destroyed in transit, no entire glyph will be lost.

At the top left and top right of each page are page numbers. For example, page number 1: The page numbers are written in binary, most significant bit first, with representing a 1 bit and representing a 0 bit. These bit shapes were chosen to be resistant to data corruption; you can change any 4 of the 9 pixels in either shape and the recipient can still recover the entire bit unambiguously. There is an ambiguity about whether the numerals are written right to left or left to right—is the number 1 or the number 16?—but the aliens should be able to figure it out by comparing page numbers on consecutive pages; this in turn will help them when time comes for them to figure out the digit symbols.

Every page has a topic header, in this case , which roughly means “mathematics”. The topics of the following pages are something like:

  • 1–5 Mathematics
  • 6–11,21 Physics
  • 12–14,19–20 The Earth
  • 15–18 Human anatomy and biochemistry
  • 22 Cosmology
  • 23 Questions

In the next article I'll explain the contents of page 1. Each following article will appear two or three days later and will explain another page.

To follow the whole series of articles in your feed reader, subscribe to: RSS Atom

Zip file of all 23 pages

(Next article, to appear 2015-08-10: page 1)

Categories: Offsite Blogs

Anybody using LiquidHaskell ?

Haskell on Reddit - Sat, 08/08/2015 - 12:34pm

After reading the following post, I was wondering, is anybody using LiquidHaskell or have any experience with it ? I really like the idea of it (especially being able to express the idea of ordered list for example).

submitted by maxigit
[link] [19 comments]
Categories: Incoming News

an idea for modifiyng data/newtype syntax: use `::=`instead of `=`

haskell-cafe - Sat, 08/08/2015 - 12:09pm
Hello, i would like to suggest an idea for modifying the basic data/newtype syntax in Haskell: replace the equality sign `=` with `::=`. When i started learning Haskell, the most confusing part of the syntax for me was the equality sign in `data` definition. I could not even guess what the `data` definition meant without reading a chapter or two about types in Haskell, and i think it was partially due to the equality sign. I still find this notation inconsistent with other uses of the equality sign in Haskell and in general. For example, in type Name = String data Date = Date Int Int Int data Anniversary = Birthday Name Date | Wedding Name Name Date the second line is particularly disorienting IMO because on two sides of the equality, `Date` denotes different things. As far as i understand, in all contexts except those of `data` and `newtype` definitions, the equality sign in Haskell denotes the actual equality for all purposes: if a line foo x y = bar y x is present in a program, `
Categories: Offsite Discussion

A non-associative binary operation for which folds are well-defined?

Haskell on Reddit - Sat, 08/08/2015 - 7:42am

I've been reading Maartens Fokkinga's A Gentle Introduction to Category Theory and it's a nice read, but there is an exercise (on page 5) that is as simple as it is baffling:

Exercise: find a non-associative operation for which ⊕/ is well defined. Conclude that associativity of ⊕ is a sufficient, but not necessary condition for ⊕/ to be a well defined function on sequences.

By the very definition of non-associativity, if ⊕ is non-associative, then there exists at least one triple (a, b, c) for which (a ⊕ b) ⊕ c ≠ a ⊕ (b ⊕ c). Doesn't this mean that already the fold (a ⊕ b ⊕ c) is undefined, entailing the ill-definedness of the fold function ⊕/ ? How can there exist a solution to this exercise, then?

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

Content-Type Bliss

Haskell on Reddit - Sat, 08/08/2015 - 6:08am
Categories: Incoming News

monads, memoization etc

haskell-cafe - Sat, 08/08/2015 - 2:11am
Hi everyone, I'm new to Haskell and decided to learn a bit about monads and their utility. Actually, what worked nicely for me was: to read first several pages from "Computational lambda-calculus and monads", then do exercises from, and then map these exercises to actual functions in the standard library. Then, I decided to implement memoization to practice a bit with ST, HashTable's and such. Here is what I managed to get: . This code computes Fibonacci numbers while caching the intermediate values in a hash table. I tried to make the code as fast as possible (it runs in under 15 seconds, when computing 1M'th Fibonacci number modulo 999983). It uses the package hashtables. I have several question about all this. First, is there a cheap way to speed this code up? Note that I'm interested in a universal memoization strategy, that is I don't want to use arrays instead of hash tables etc. Second, is this
Categories: Offsite Discussion

More concise code using phantom types

haskell-cafe - Sat, 08/08/2015 - 12:28am
Hello! Consider the following code: module Units where data Units a = U Double deriving Eq units :: Double -> a -> Units a units value _ = U value data Meters data Yards meters = undefined :: Meters yards = undefined :: Yards instance Show Meters where show _ = "meters" instance Show Yards where show _ = "yards" extractA :: Units a -> a extractA = undefined instance Show a => Show (Units a) where show u< at >(U value) = show value ++ " " ++ show $ extractA u main = (print $ units 5 yards) >> (print $ units 5 meters) Is it possible to use something instead extractA function here? For example, substitute "extractA u” with “undefined :: a”? GHC disallows it, so is there a way to explain that I only need a token with type a? Also, with highlighting on lpaste: With regards, Nikita Kartashov _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

ANN: happstack-server-tls-cryptonite

haskell-cafe - Sat, 08/08/2015 - 12:12am
Hi, I'd like to announce happstack-server-tls-cryptonite, package adding native TLS support to happstack, utilizing hs-tls and cryptonite packages by Vincent Hanquez. You can now run secure web server without using OpenSSL or other foreign libraries. This package is almost drop-in replacement for happstack-server-tls, just change Happstack.Server.SimpleHTTPS to Happstack.Server.SimpleTLS in imports. Regards, Andrey
Categories: Offsite Discussion

simultaneous ghc versions

glasgow-user - Fri, 07/31/2015 - 7:10pm
The recent release of ghc 7.10.2 reminded me of something I meant to ask about a long time ago. Most of the binaries ghc installs are versioned (x linked to x-7.10.2), with some exceptions (hpc and hsc2hs). Shouldn't they all be versioned? Also, 'haddock' is inconsistent with all the rest, in that it's haddock linked to haddock-ghc-7.10.2. I've long used a few shell scripts (recently upgraded to python) to manage ghc installs. A 'set' which creates symlinks to make a particular version current, and an 'rm' to remove all traces of a version. But due to the inconsistency, I have to remember to run "fix" first, which moves the unversioned binaries to versioned names. As an aside, I have three scripts I use all the time: set version, remove version, and remove library. Come to think of it, shouldn't ghc include this, instead of everyone creating their own shell scripts by hand?
Categories: Offsite Discussion

broken source link

glasgow-user - Fri, 07/24/2015 - 8:59am
Hi, when trying to look up the original definition for Data.List.transpose in I found that the source link does not work. Could this be fixed? Or should I look elsewhere for the sources? Cheers Christian P.S. my looking up transpose was inspired by
Categories: Offsite Discussion

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