News aggregator

How did Haskell make you a better programmer?

Haskell on Reddit - Thu, 06/18/2015 - 2:39pm

Some people claim that after learning Haskell, they became a better programmer. What's your Haskell story?

submitted by DrDeluX
[link] [78 comments]
Categories: Incoming News

when does strictness matter

Haskell on Reddit - Thu, 06/18/2015 - 2:27pm

I'm trying to work out some programs that would have different performance with and without strictness. The most common is folds or accumulating parameters. Are there any other examples?

submitted by remwang
[link] [10 comments]
Categories: Incoming News

[Help] Installing packages with cabal

Haskell on Reddit - Thu, 06/18/2015 - 12:09pm

I'm very new to Haskell, but I've been able to write some basic programs without any trouble. I wanted to install hlint and ghc-mod as they are dependencies for some Atom packages (ide-haskell, linter-hlint, haskell-ghc-mod) but every time I try cabal install hlint ghc-mod then I get some dependency error (I'm assuming this is the Cabal hell I've heard so much about...).

I am running GHC 7.10.1 and Cabal, both the latest stable releases from Homebrew. I have also tried to use stack and Cabal + Stackage Nightly to install these packages globally, however stack doesn't like my version of GHC, and the Stackage Nightly global config file gives me some obscure fromFlag NoFlag. Use fromFlagOrDefault error and refuses to update its package list.

It's frustrating because I don't know what I'm doing wrong. These are the first two packages I have ever tried to install. Is there no alternative package manager or something, like Homebrew for Mac or NPM for JavaScript, that "just works"?

EDIT: Also, what is the best (pain-free) way to install GHC and Cabal? Right now I'm using Homebrew, but I know I could be using the Haskell Platform or this... are there any best practices for setting this all up properly?

EDIT #2: hlint was failing to build because it required happy, so I did cabal install happy and then retried cabal install hlint and it was successful! I was not able to installghc-mod (this didn't work).

submitted by evanrelf
[link] [42 comments]
Categories: Incoming News

No way to retrieve the base of a Set or Map in O(1)

libraries list - Thu, 06/18/2015 - 11:27am
Hello, there seems to be no way to retrieve the base of a Set or Map in O(1), since there is no relevant function in the respective libraries and the constructors Bin and Tip are not exported in any module. I think retrieving any one element from a Set or Map might be useful sometimes, so I modestly ask for an implementation. I see that there is splitRoot, but the docs advice, not to rely on the current form of the resulting list, since it might be subject to change. Having this function, with its current result, it might be interesting to be able to efficiently build the union of the lower and the upper parts by simply connecting the trees at their bases. What do you think? Kind regards, André _______________________________________________ Libraries mailing list Libraries< at >
Categories: Offsite Discussion

Canberra Functional Programming Group

haskell-cafe - Thu, 06/18/2015 - 9:11am
In case you live in Canberra, Australia and were unaware of this already, Alex Mason (aka Axman6) is helping to arrange/organise a new functional programming group. The first meeting for it is next week on 24 June (including free pizza!). For more information please see
Categories: Offsite Discussion

Type signatures in do blocks

Haskell on Reddit - Thu, 06/18/2015 - 8:47am

Would it be possible to extend GHC to allow type signatures like the following in do blocks:

main :: IO () main = do msg :: String msg <- getLine putStrLn msg submitted by martingalemeasure
[link] [20 comments]
Categories: Incoming News

[Deadline Extended: 15 July 2015] IEEE 11th International Conference on Innovations IIT'15, Dubai, UAE

General haskell list - Thu, 06/18/2015 - 8:16am
Dear Colleagues, Due to numerous requests, and end-of-semester busy period for authors, we are pleased to inform you that the papers submission deadline has been extended. Kindly find the CFP below. Apologies if you receive multiple copies of this CFP. Please feel free to distribute the IIT'15 CFP to your colleagues, students and networks. CALL FOR PAPERS 2015 11th International Conference on Innovations in Information Technology (IIT'15) Special Theme: Smart Living Cities, Big Data and Sustainable Development November 01-03, 2015, Dubai, UAE ------------IMPORTANT: Submission Deadline Extended----- More information is available at: IEEE Technical Sponsorship by IEEE Computer Society. All papers will be published by IEEE and included in IEEE Xplore digital library, and all other global indices. News: Extended papers will be invited for possible publication in a Springer Book, indexed in Springer global indices, one of the largest databases in the wo
Categories: Incoming News


Haskell on Reddit - Thu, 06/18/2015 - 7:10am

There's a function in Data.List that I often find useful named replicate. However, the idea of replication can be extended more generally to any Monoid. It's a little bit different because a list has a notion of "single element" while Monoids in general do not. So the type signatures are:

replicate :: Int -> a -> [a] replicateMonoid :: Monoid m => Int -> m -> m

What I came here to ask is if this function could be added to Data.Monoid. It's pretty useful, and I can't help but notice that Data.Monoid doesn't come with nearly as many helper functions as Control.Monad. I know that adding to base is always potentially a breaking change, but this doesn't seem to break much. Also, if anyone else has thoughts on good helper monoid functions, I would appreciate hearing about those.

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

idris for compile-to-javascript functionality?

Haskell on Reddit - Thu, 06/18/2015 - 6:20am

When we discuss compile-to-javascript options around here, discussion seems to focus on elm, purescript, haste, and fay.

What about idris? People seem to like it as a language, but it never comes up in the javascript option discussions. Is the compile-to-javascript functionality too immature for production? Has anyone tried using it in conjunction with yesod or other haskell server-side options?

submitted by klaxion
[link] [5 comments]
Categories: Incoming News

[Help] Haskell & Javascript

Haskell on Reddit - Thu, 06/18/2015 - 4:17am

My goal is to build SPAs (Single Page Applications). I thought that I could use Haskell to do that thanks to GHCJS but yesterday I found out that GHCJS produces javascript code which is big and slow.

The problem seems to be the mismatch between the evaluation strategy and primitive types of Hakell and Javascript. In fact, Purescript eliminates this mismatch and produces short and fast javascript code. A problem with Purescript is that it has a low bus-factor.

I see three possibilities:

  1. I use GHC + GHCJS hoping that GHCJS becomes more efficient (is this likely?)
  2. I use Purescript on both client-side & serverside (Node.js) and study its source code so that the low bus-factor is not a problem anymore.
  3. I use Scala + Scala.js which are both very efficient. The only problem is that functional programming in Scala is less ideal.

As a requirement, I want to use the same language on client and server so that I can share code.

Any thoughts or suggestions?

submitted by Kiuhnm
[link] [64 comments]
Categories: Incoming News

phantom types and record syntax

haskell-cafe - Thu, 06/18/2015 - 3:45am
Hi All, My apologies if this is not the right forum, but am not satisfied with my current understanding. I am surprised that this program compiles in GHC: ----- data UserSupplied = UserSupplied -- i.e. unsafe data Safe = Safe data Username a = Username { first :: String, last :: String} sanitize :: Username UserSupplied -> Username Safe sanitize name = name { first = "John" } main = putStrLn "Hi!" ----- My trouble is that it seems the record syntax is*implicitly* converting from one type to the other. It seems I would have to remove the phantom type by adding a tag to avoid this: ----- data Username a = Username { first :: String, last :: String, tag :: a } sanitize :: Username UserSupplied -> Username Safe sanitize name = name { first = "John" } -- FAIL as expected!! :-) ----- But this makes me unwilling to use phantom types for security as I would be worried of unwittingly making the conversion. Could somebody sprinkle some insight into why this is "converted automatically" for ph
Categories: Offsite Discussion

Deploying Haskell libraries and applications to end-users

Haskell on Reddit - Thu, 06/18/2015 - 2:46am


I wish this post be useful as a survey and a way to create an objective debate about deployment.

The Haskell community has several tools to work in Haskell. Of course, GHC and cabal/hackage. We have ghc-mod, we have linters, we have stack/stackage. For development purposes, we could have more – like a better cabal with a way to unregister packages and so on. My point is about deployment now.

When you want to deploy something, you cannot expect the user to know the technology your product uses. For instance, when shipping tools like VLC or Thunderbird, the user is not asked to know C, C++ or whatever. Typically, the user can use the package manager of their distribution (pacman or yaourt, yum, portage, apt-get, and so on and so forth).

Yesterday, I decided to do the same things with all my libraries I maintain. I succeeded to deploy al on archlinux, in the AUR. However, I failed to deploy the others because of missing dependencies in the AUR. Archlinux has several places where to pick Haskell packages, which is very wrong to me ([community], AUR, ArchHaskell dedicated repository…). Even though the dependencies are correctly resolved and my applications and libraries correctly deployed on Archlinux, that doesn’t solve anything for the user on Windows or Ubuntu or Red Hat.

Then, my question. What would be the best approach to deploy something so that anyone can use it? cabal is not a package manager for a end-user. I see that for developers only. Maybe stack is the answer, but again, the user has to know that the tool they’re looking for is written in Haskell, and that bothers me a lot. Maybe I just want the impossible to happen – that is, a universal package manager that would be accessible on all platforms. Maybe there’s another way to correctly ship something?

What do you think?

EDIT: I have some ideas on how to automate the integration of hackage inside the AUR for Archlinux. We just need a tool to convert a .cabal into a PKGBUILD and .install files:

cd /tmp cabal list --simple-output | cut -f1 -d' ' | uniq > hackage.txt

For all packages in hackage.txt, we just have to lookup the .cabal on hackage then we can run cabal2arch, and upload them to the AUR. By the way, for the record, wc -l hackage.txt gives around 9k packages!

submitted by _skp
[link] [9 comments]
Categories: Incoming News

Haskell Weekly News

haskell-cafe - Thu, 06/18/2015 - 2:04am
*Top Picks:* - Andrew Gibiansky <> announces the Mathematica-inspired REPL 2.0 IHaskell as a web-app you can play with right now <>. Bouquets include: "This is an awesome step up from the tryhaskell window." Also, "I love IHaskell. I've already started preferring it to ghci since it's so much easier to use." More /r/haskell love here <> . - Mihai Maruseac and Alejandro Serrano Mena publish the 28th Haskell Communities and Activities Report <>. Top comment on HN <>: "Haskell is backed by a truly amazing community. Haskell will continue to inspire people to build better, safer software. I hope that the values of tolerance, respect and benevolence that most of the Haskel
Categories: Offsite Discussion

WebAssembly as a target?

Haskell on Reddit - Thu, 06/18/2015 - 12:59am

WebAssembly is all over the news today. I wonder if Haskell compiler experts looked at the spec, and checked if it would be a suitable target to compile Haskell into. Does WebAssembly have fundamental impediments like JVM's inability to do TCO efficiently? If it does, maybe it's time to chime in to the design committee, while the spec is still in its infancy...

submitted by lukewarm
[link] [36 comments]
Categories: Incoming News

Weekly Questions for Newbies?

Haskell on Reddit - Wed, 06/17/2015 - 9:08pm

Over in /r/clojure they have been offering a weekly "New Clojurists: Ask Anything" thread for a while.

Participation is pretty high, and it seems to generate good questions. Having a nice consolidated location of introductory questions I find to be very valuable.

With Haskell's intimidating reputation, I thought a similar regular outreach thing might be warmly welcomed. It also could provide a nice vector to give voice to what beginners are looking for and/or struggling with.

Do you think it would be worthwhile trying it out here--a weekly New Haskellers: Ask Anything thread?

submitted by xelxebar
[link] [30 comments]
Categories: Incoming News

SHA sums of cabal-install binaries

libraries list - Wed, 06/17/2015 - 9:03pm
Hi, are the SHA sums of cabal-install binaries available somewhere? GHC provides them on the download pages, but I couldn't find them anywhere for cabal-install. If not, would it be possible to provide them? Thanks, Petr _______________________________________________ Libraries mailing list Libraries< at >
Categories: Offsite Discussion

Trying to remember the name of a fold fusion paper

Haskell on Reddit - Wed, 06/17/2015 - 7:53pm

I'm trying to remember the name of a haskell paper I read. The motivating example was the old "calculate the mean of a list in a single traversal" saw.

I think the construction they ended up with was something like

{-# LANGUAGE ExistentialQuantification #-} module Fold where import Control.Applicative import Prelude hiding (sum, length, foldr) import Data.Foldable hiding (sum) import Data.Profunctor data Fold a b = forall x. Fold { init :: x, step :: a -> x -> x, final :: x -> b } runFold :: Foldable t => Fold a b -> t a -> b runFold (Fold i s f) = f . foldr s i instance Functor (Fold a) where fmap g (Fold i s f) = Fold i s (g . f) instance Profunctor Fold where lmap g (Fold i s f) = Fold i (s . g) f rmap = fmap dimap g h (Fold i s f) = Fold i (s . g) (h . f) instance Applicative (Fold a) where Fold i s f <*> Fold j t g = Fold (i,j) (\a (i,j) -> (s a i, t a j)) (\(i,j) -> f i (g j)) pure = Fold () (flip const) . const instance Num b => Num (Fold a b) where (+) = liftA2 (+) (*) = liftA2 (*) (-) = liftA2 (-) negate = fmap negate abs = fmap abs signum = fmap signum fromInteger = pure . fromInteger instance Fractional b => Fractional (Fold a b) where (/) = liftA2 (/) recip = fmap recip fromRational = pure . fromRational length :: Num b => Fold a b length = Fold 0 (const (+1)) id sum :: Num a => Fold a a sum = Fold 0 (+) id

So you could just define mean as

mean :: Fractional a => Fold a a mean = sum / length

Is this jogging anyone else's memory?

submitted by rampion
[link] [5 comments]
Categories: Incoming News