News aggregator

How to deal with duplicate record fields

Haskell on Reddit - Sun, 09/13/2015 - 2:57am

Im modeling data for my library now

It will come in JSON format and I am relying on DeriveGeneric extension to get my ToJSON / FromJSON Instances. However, there quite a lot of field duplicates in my records.

As far as I understood, I need something like DuplicateRecordFields extension

Is there any way around ?

thanks in advance

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

Update: I got spacemacs working, using stack, with autocomplete and everything.

Haskell on Reddit - Sun, 09/13/2015 - 12:05am

This is my .spacemacs.

I basically did stack install stylish-haskell hasktags hlint structured-haskell-mode, and installed ghci-ng and ghc-mod from source. That is all.

I hope this helps. I've been messing with Emacs to get this up for a long time.

Edit: ghci-ng is up as well, praise be to /u/cies010! Now to quit fiddling with Emacs and get some real work done. :)

submitted by octatoan
[link] [47 comments]
Categories: Incoming News

Hostility to well defined concepts in other language communities

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

This is a genuine issue that I just dealt with: I asked in a Ruby forum about a core language feature, and I got abuse. It was weird as hell. But I've seen this kind of thing before, and I think the common denominator is that my questions inquired about the definition of a thing; it's signature and it's defined behavior. And now, when I think of it, Ruby is the non plus ultra in languages without written specification.

At any rate, the whole thing makes me appreciate Haskell and the community, all the more.

EDIT: The transcript

The person replying to me is a prominent ruby developer:

reading comprehension not your thing?


what do you really want to know?


welp... I'm done trying to pull teeth from this one. have fun with that.

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

Anyone got spacemacs and stack playing well together?

Haskell on Reddit - Sat, 09/12/2015 - 8:09am

I just did a fresh Arch Linux install, and installed Emacs (GNU, 24.5.1) on it.

What would be the best way to install spacemacs and set everything up so that it all just works? I'd like structured-haskell-mode, autocomplete and type inspection to work.

If I must use cabal (I don't want to), what would the corresponding plan of action be in that case?

submitted by octatoan
[link] [32 comments]
Categories: Incoming News

Graph-based Haskell

Haskell on Reddit - Sat, 09/12/2015 - 5:11am

I'm designing a graph-based FP language which compiles to Haskell.

I want to create something practical so I decided to extend Haskell instead of starting from scratch. This way, people will be able to use my language to do some real stuff.

In my opinion, any attempt to get rid of text is doomed to fail so, in my language, expressions are embedded in the graph, but the language encourages the use of short expressions.

The three main features of my language are

  1. Simplicity
  2. Regularity
  3. "Optionality"

Simplicity means that there must be few rules. Every Haskeller should be able to learn the language in 20 minutes or less. Mastering the language and get used to the new "paradigm" will require more time of course.

Regularity means no exceptions and, as a consequence, great composability thanks to the fact that the semantic of a graph element is independent of the context. For instance, at one point I realized that I could represent ADTs as graphs without adding any new rule or graph element.

Optionality means that whatever you can do with a graph elements, you can do with just text. This helps getting the best of both worlds (text and graphical). This also lowers the entry barrier a lot.

I've been working on this idea for about a week so I've just started!

What I need is a way to parse Haskell code, detect errors, etc... In the future I'll think about graph highlighting(!) and autocompletion. What's the easiest way of doing this?

Now please sit down.

I'd like to implement the graph editor in Scala (sic). In fact, this project is a way of getting some experience with Scala.

Maybe I could ask the authors of Frege (aka Haskell on the JVM)?

I'm still deciding on the platform: JVM or JS?

I'm craving suggestions!

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

wren gayle romano: What do we mean when we say "the Haskell community"?

Planet Haskell - Fri, 09/11/2015 - 9:34pm

One of the folks I've chatted with a bunch online and finally got to meet in-person this year was Gershom. Towards the end of the symposium, he mentioned the post I linked to last time about my pulling away from Haskell communities. But the way he phrased it really struck me. And I wanted to comment on that.

I guess the crux of it comes down to, what do we mean when we say "the Haskell community"? What I meant when writing that post over a year ago was the online community of Haskell learners/practitioners (i.e., the folks who dominate spaces like reddit). But what Gershom's comment suggested was the academic community of FP researchers who work on/with Haskell (i.e., the folks who dominate spaces like ICFP). These two communities have always been intertwined, but as Haskell gains popularity they feel more and more distinct.

FWIW, I do still feel welcome as part of the academic community. There are some things I could comment on, sure, but those have more to do (i think) the general issue of being a woman in tech than they do with Haskell per se. Of course, this only underscores the concern of my original post. The free exchange between academics and practitioners was always a big part of what I've loved about the (general) Haskell community. Were not for that exchange, the spark planted by Mark Jones would never have fanned into the flame of my current research. As that free exchange unravels, this pathway from interested novice to researcher is cut off. And that pathway is crucial for the vibrancy of the community, as well as for addressing those general issues of being a minority in tech.

Twitter Facebook Google+ Tumblr WordPress

Categories: Offsite Blogs

Permissive imports proposal

Haskell on Reddit - Fri, 09/11/2015 - 1:32pm

Did anything ever happen with I really like it, perhaps because I had the same idea somewhat later.

Plus (but the status there is clear).

submitted by alexeyr
[link] [51 comments]
Categories: Incoming News

Ideas for haskell exercises

Haskell on Reddit - Fri, 09/11/2015 - 12:30pm

Hello reddit, I am learning haskell, and I am already knowing a bit. I would like to create a list of exercises/challenges for me as well as other new haskellers, which will be good for learning the language. The ideas you come up with will be collected on a page on my blog with your names on :)

submitted by petermikkelsen
[link] [21 comments]
Categories: Incoming News

Ken T Takusagawa: [ajoyvtsr] Executable specification of MapReduce

Planet Haskell - Fri, 09/11/2015 - 11:39am

We present, for pedagogical purposes, a simple Haskell implementation of MapReduce.  MapReduce is a technology idea popularized by Google.  The polymorphic type signature specifies exactly what the input functions passed in by the user (mapFn and reduceFn) are supposed to do. Of course, a real MapReduce implementation would be parallel across multiple machines, fault tolerant, use external sort etc.

{-# LANGUAGE ScopedTypeVariables #-}
import Data.List(groupBy, sortOn);

mapReduce :: forall a key value b . Ord key => (a -> [(key,value)]) -> (key -> [(a,value)] -> b) -> [a] -> [b];
mapReduce mapFn reduceFn input = map (uncurry reduceFn) $ shuffle $ do { -- list monad
  x :: a <- input;
  y :: (key,value) <- mapFn x;
  return (x,y); -- all pairs

-- profiling reveals the majority of the computation time is spent here, not too surprising.
shuffle :: forall a key value . Ord key => [(a,(key,value))] -> [(key,[(a,value)])];
shuffle = let {
  get_a :: (a,(key,value)) -> a;
  get_a (a1,_) = a1;
  get_key :: (a,(key,value)) -> key;
  get_key (_,(k,_)) = k;
  get_value :: (a,(key,value)) -> value;
  get_value (_,(_,v)) = v;
  rearrange :: [(a,(key,value))] -> (key,[(a,value)]);
  rearrange l = (get_key $ head l, zip (map get_a l) (map get_value l));
} in map rearrange . groupBy (equating get_key) . sortOn get_key; -- point-free style

-- regular list sort 364.75 sec
-- Seq.unstableSortBy = 440.98 sec

-- cf Data.Ord.comparing
equating :: Eq b => (a -> b) -> a -> a -> Bool;
equating f x y = (f x) == (f y);

Categories: Offsite Blogs

Well-Typed.Com: Haskell Hackathon, Haskell eXchange, Haskell courses in London, October 2015

Planet Haskell - Fri, 09/11/2015 - 9:30am
Haskell events in London

In the time from 5–13 October, we are (co-)organizing a number of Haskell-related events in London, with Skills Matter.

Here’s the overview:

Haskell infrastructure Hackathon

We’ll co-organize and participate in a two-day Haskell Hackathon, which takes place directly after the Haskell eXchange.

This Hackathon aims at bringing together Haskell developers – both beginners and experts – who want to help improve the Haskell infrastructure, predominantly Hackage and Cabal.

We’ll aim to arrange some introductory overview talks, to e.g. provide an overview over the code bases and the most important open issues.

Participation is free, but please register via Skills Matter.

Haskell eXchange

The Haskell eXchange 2015 will be bigger than ever before. Expanded to two days and two tracks, it features four keynotes, two tutorials, and more than twenty speakers in total.

Here’s the preliminary list of speakers and topics:

  • Keynote by Simon Peyton Jones on “Into the Core: understanding GHC’s intermediate language”
  • Keynote by Lennart Augustsson on “Giving Types to Relations”
  • Keynote by Simon Marlow on “Fun with Haxl”
  • Keynote by Luite Stegeman on “Solving the JavaScript Problem”
  • Workshop by Tom Ellis on “Opaleye”
  • Workshop by Ivan Perez on “Game programming for fun and profit”
  • Talk by Jasper van der Jeugt on “The Ludwig DSL”
  • Talk by Gershom Bazerman on “Programming with Universal Properties”
  • Talk by Neil Mitchell on “Shake”
  • Talk by Johan Tibell on “High-performance Haskell”
  • Talk by Francesco Mazzoli on “inline-c”
  • Talk by Matthew Pickering on “ghc-exactprint”
  • Talk by Alp Mestanogullari on “Servant”
  • Talk by Alfredo di Napoli on “Using Haskell at Iris Connect”
  • Talk by Miëtek Bak on “Building your own proof assistant”
  • Talk by Lars Hupel and Miles Sabin on “What Haskell can learn from Scala”
  • Talk by Vladimir Kirillov on “Haskell goes Devops”
  • Talk by Nicolas Wu on “Transformers: handlers in disguise”
  • Short talk by Martijn van Steenbergen on “JsonGrammar”
  • Short talk by Bodil Stokke on “PureScript”
  • Short talk by Blair Archibald on “HdpH”
  • Short talk by Philipp Kant on “Data avoidance in Haskell”
  • Short talk by Andraž Bajt on “Using Haskell as a thinking tool”
  • Short talk by San Gillis on “Haskell development with Docker”

Registration is possible via Skills Matter. The promo code HASKELL-EXCHANGE-25 (has been extended to be valid until September 19!) can be used to get a 25% reduction.

Haskell courses

In connection with the Haskell eXchange and the Haskell infrastructure hackathon, Well-Typed are offering courses with Skills Matter. If you cannot come to London in October, but are interested in our course offerings, see Training for more information.

Fast Track to Haskell

The Fast Track course is a two-day compact introduction to Haskell, assuming previous programming experience, but no familiarity with Haskell or functional programming. It covers topics such as defining datatypes and functions, higher-order functions, explicit side effects and monads.

Guide to the Haskell Type System

The Guide to the Haskell Type System course is a one-day introduction to various type-system extensions that GHC offers, such as GADTs, rank-n polymorphism, type families and more. It assumes familiarity with Haskell. It does not make use of any other advanced Haskell concepts except for the ones it introduces, so it is in principle possible to follow this course directly after Fast Track. However, as this course focuses very much on the extreme aspects of Haskell’s type system, it should probably only be taken by participants who are enthusiastic about static types and perhaps familiar with a strong static type system from another language.

Advanced Haskell

The Advanced Haskell course is targeted at Haskellers who are comfortable with the Haskell basics, and want to learn more about how to write larger Haskell programs. The course covers topics such as data structures, their complexity, pitfalls of lazy evaluation, profiling, GHC’s internal core language, and some more advanced design patterns such as monad transformers and how to use them effectively. Once again, strictly speaking this course can be followed when just having completed Fast Track. But the nature of this course’s contents also means that several of the topics can be more appreciated if one has written more Haskell code in practice already.

Categories: Offsite Blogs

How to easily create portable binaries for linux?

Haskell on Reddit - Fri, 09/11/2015 - 8:43am

So that they can be easily installed in /opt, or in user's home dir, or in a docker container, for example.

What's the best location to put the share, lib, and doc folders on the target? For example, when installing ghc from hvr's PPA into /opt, the share, lib, and doc folders are included there, not in the /usr.

Also, when building with either cabal or stack, the paths from the build machine are embedded in the binary which makes it not portable. For example, when running gitit from within a Docker container, I get

$ gitit --print-default-config > gitit.cnf gitit: /<home path>/.stack-work/install/x86_64-linux/lts-3.4/7.10.2/share/x86_64-linux-ghc-7.10.2/gitit- openFile: does not exist (No such file or directory)

Which reveals how and where the gitit executable was built.

Do I have to assume fixed locations like /opt/gitit/, /opt/gitit/, /opt/gitit/, etc. using cabal install's --prefix=DIR bake this prefix in preparation of installation?

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

wren gayle romano: Back home from ICFP

Planet Haskell - Fri, 09/11/2015 - 1:38am

Got back from Vancouver a couple days ago. The return flight was hell, but other than that the trip was pretty good. Got to meet a whole bunch of folks who read my blog (hi!), which was super cool. It always gives me warm fuzzies to know people are actually interested in my stuff. (You'd think I'd get used to it after a while, but no, evidently childhood scars still remain years after developing a solid sense of self-esteem. Go fig.) Of course, now I feel bad about not having written much of late. I have a few posts I've been meaning to write —mostly technical ones—, and I'm thinking I might should try to kick those out as a way to get back into the daily writing habit needed for finishing up my dissertation.

Since handing out my card at ICFP, I've been hacking around on my website. I'm still working on getting my publications/presentations to be properly formatted, and the timestamps in the footers on a couple pages are busted, but other than that I think it's in pretty good shape. I also took part in a keysigning party for the purpose of building a WoT as part of the developing story for how we securely deliver packages in Haskell. My key is up on Keybase as well as on my website (along with all my other contact info).

After a week of great talks, too much drinking, and too little sleep, I met up with a dear friend from undergrad. It's been far far too long since we've had a chance to hang out (alas, he couldn't make the wedding last year), but he's one of those friends you can just fall right back into. It's funny how much can change and yet stay the same. In one of our ambling walks I dragged him into a clothing store —something I never would've done pre-transition. He didn't seem to mind. He just went along like it's the sort of thing we've always done. And it felt to me like the sort of thing we could've always done. Recently he's been ref'ing for roller derby up in Victoria, and after talking about it I'm thinking I might try my hand at it. Sounds like a lot of fun. We have a team in Bloomington, and they're doing a training/recruiting thing, though alas I'll miss it since I'll be in Mountain View on the 14th. I'll see if I can't find some other way to get introduced.

Twitter Facebook Google+ Tumblr WordPress

Categories: Offsite Blogs

Strange problem with inference

haskell-cafe - Fri, 09/11/2015 - 12:58am
Hi Cafe, I've been playing around with lens and stumbled upon strange GHC behaviour. Consider this source (using lens package and GHC 7.10.2): {-# LANGUAGE TypeFamilies #-} import Control.Lens class Test a where type TestT a myiso :: Iso' a (TestT a) test1 :: Test a => a -> TestT a test1 = view myiso test2 :: Test a => TestT a -> a test2 = view (from myiso) GHC would emit this error: /tmp/test.hs:13:9: Could not deduce (Control.Monad.Reader.Class.MonadReader (TestT a) ((->) (TestT a))) arising from a use of ‘view’ from the context (Test a) bound by the type signature for test2 :: Test a => TestT a -> a at /tmp/test.hs:12:10-31 In the expression: view (from myiso) In an equation for ‘test2’: test2 = view (from myiso) Failed, modules loaded: none. However, `MonadReader r ((->) r)` is defined for any and all `r`! Furthermore, `test1` has no problem with this and `view` there uses this instance too. The only difference that I see is t
Categories: Offsite Discussion

Mark Jason Dominus: A message to the aliens, part 8/23 (time and space)

Planet Haskell - Thu, 09/10/2015 - 6:00pm

Earlier articles: Introduction Common features Page 1 (numerals) Page 2 (arithmetic) Page 3 (exponents) Page 4 (algebra) Page 5 (geometry) Page 6 (chemistry) Page 7 (mass)

This is page 8 of the Cosmic Call message. An explanation follows.

The 10 digits are:


The main feature of this page is a diagram of the electron energy levels for a hydrogen atom, annotated at the top with the glyph for hydrogen and at the bottom with the glyph for energy . The four lowest levels are shown, with the lowest level (the ground state) at the bottom. Above these is a thicker bar representing the way the higher energy levels all pile up into a smear. If the bottom level is at 0 and the smear is at 1, then the three intermediate levels are shown at approximately their exact values of and ; these are given by the Rydberg formula.

The aliens should be familiar with hydrogen. Normally a hydrogen atom's sole electron is in the ground state. If a photon couples with the electron, say because starlight is falling on the atom, or someone has applied an electric current to it, the electron may jump up to a higher quantum state. (This is the only correct use of the phrase "quantum leap".) When it drops back down, it will emit a photon. But the energy of the emitted photon must be one of a few particular values, corresponding to the difference between the old and the new energy level; the electron never drops down partway to the next level. An incandescent cloud of hydrogen gas will not typically glow in every possible color; it will emit light in only a few particular, characteristic wavelengths, and these colors can be separated with a spectroscope. The wavelengths of these characteristic colors of light, visible everywhere the message is likely to reach, provide a basis for defining the meter.

For example, the second pair of numbers labels the transition from the to the state, and an electron transiting between these two states will always emit a photon with a wavelength of 656.2852 nanonmeters and a frequency of 456.8021 terahertz, and these are the two numbers in the pair. The product of the two numbers in each pair is a constant, which should further confirm to the recipients that they have the right interpretation. The constant product is close to 299792458, which is the speed of light in meters per second. This defines four glyphs, for wavelength and frequency, and meters and hertz.


The following item

defines the second as the inverse of the hertz (written as and as ).

Finally, the speed of light is given, first theoretically, as the product of wavelength and frequency and then numerically, as 299792458 meters per second .

The next article will discuss page 9, shown at right. (Click to enlarge.)
Try to figure it out before then.

Categories: Offsite Blogs

Two kinds of backtracking

Haskell on Reddit - Thu, 09/10/2015 - 5:56pm
Categories: Incoming News

Best deployment method for Hakyll websites (withStack)?

haskell-cafe - Thu, 09/10/2015 - 2:49pm
Hello, Note, this is not a Hakyll question, after all. I’m trying to host a hakyll website on a CentOS 7 server. I want to replicate the setup I had with the previous site, made with Jekyll: at each push on the git repository (hosted on the same server), the branch is recompiled and deployed to the web server. I already have the git hooks in place etc… The problem is how to manage the installation of ghc, hakyll, and their dependencies. I really really wish to have a clean solution. I really like stack, but its “per-user” directories make me wonder. The site compilation has to be performed by the git user account, which does not have an home directory. Can I setup a stack installation of a set of packages and then point stack to use that and only that? Also, how about the integration with docker? Is it really so painless as it is advertised? If I’ve understood correctly, I could install the docker image with stackage packages already installed, and tell stack to use that image with docker, h
Categories: Offsite Discussion