News aggregator

Erik de Castro Lopo: Haskell : A neat trick for GHCi

Planet Haskell - Fri, 10/17/2014 - 4:16pm

Just found a really nice little hack that makes working in the GHC interactive REPL a little easier and more convenient. First of all, I added the following line to my ~/.ghci file.

:set -DGHC_INTERACTIVE

All that line does is define a GHC_INTERACTIVE pre-processor symbol.

Then in a file that I want to load into the REPL, I need to add this to the top of the file:

{-# LANGUAGE CPP #-}

and then in the file I can do things like:

#ifdef GHC_INTERACTIVE import Data.Aeson.Encode.Pretty prettyPrint :: Value -> IO () prettyPrint = LBS.putStrLn . encodePretty #endif

In this particular case, I'm working with some relatively large chunks of JSON and its useful to be able to pretty print them when I'm the REPL, but I have no need for that function when I compile that module into my project.

Categories: Offsite Blogs

Neil Mitchell: Fixing Haddock docs on Hackage

Planet Haskell - Fri, 10/17/2014 - 2:49pm

Summary: A few weeks ago Hackage stopped generating docs. I have a script that generates the docs, and also fixes some Haddock bugs.

Update: The Haddock documentation generators are running once again, but may be somewhat behind for a little while. A few weeks ago Hackage stopped generating documentation, so if you look at recently uploaded pages they tend to either lack docs, or have very alert maintainers who did a manual upload. I've packaged up my solution, which also fixes some pretty annoying Haddock bugs. Given that I can now get docs faster and better with my script, I'll probably keep using it even after Haddock on Hackage gets restarted.

How to use it

  • You are likely to get better results if you always install the packages you use with documentation.
  • Ensure you have tar, curl, cp and cabal on your $PATH.
  • cabal update && cabal install neil
  • Make a release, don't touch any other code, then make sure you are in the project directory.
  • neil docs --username=YourHackageUsername
  • Type in your Hackage password at the prompt.

And like that, your docs are online. To see an example of something that was generated with this process, look at Shake.

What I fixed

I automated the process using scripts originally taken from the lens library, supplemented with suggestions from Reddit. I then do a number of manual fixups.

  • Haddock now makes cross-module links where it doesn't know what the target is default to types. Concretely, if I write 'Development.Shake.need' in Haddock it generates a link to #t:need, which doesn't exist, when it should be #v:need - I fix that.
  • Update: fixed in Haddock 1.14 or above, as per this ticket.
  • On Windows, if you use CPP and multiline bird-tick (>) Haddock blocks you get a blank line between each line. I fix that.
  • If you follow some of the simpler scripts links outside your package won't work (or at least, didn't for me). I fix that.

The neil tool

The neil tool is my personal set of handy Haskell scripts. I make all my releases with it (neil sdist), and do lots of checks that my packages conform to my rules (neil check). I also use it for driving my Travis instances. It's in fairly regular flux. Until now, I've always kept it in Darcs/Git and never released it - it's personal stuff tuned to how I work.

You might also notice that neil provides a library. Don't use that, I intend to delete it in a few weeks. Update: library removed.

Categories: Offsite Blogs

visual editing of haskell code for computer music

Haskell on Reddit - Fri, 10/17/2014 - 2:45pm

Hi! I recently stumbled over this article: Visual Haskell: A First Attempt (H. John Reekie, 1994)

It proposes a graphical language (called "visual haskell") isomorphic to a subset of haskell. This graphical language is inspired by well known dataflow languages used as tools for computer music (e.g. puredata). It also points out some analogies between the functional programming paradigma and the control flow paradigma.

I find the idea extremlely appealing - I wonder if there would be a way to create a tool that allows for graphical editing of haskell programs by exploiting the analogies between the functional programming paradigm and dataflow graph diagrams. Would such a tool be an adequate solution to create computer music (or more general: for modeling signal processing graphs), like puredata?

so I started to research about:

  • digital (audio) signal processing using haskell
  • existing tools for making computer music using haskell

3 Names seem to be relevant: H. John Reekie, Henning Thielemann, Paul Hudak.

These are the articles I found so far: found at http://ptolemy.eecs.berkeley.edu/~johnr/papers : found at http://www.haskell.org/haskellwiki/Synthesizer: found at http://haskell.cs.yale.edu/publications/publications-chronologically : * [Haskell School Of Music - From Signals to Symphonies (Paul Hudak, ver. 2.6 vom Januar 2014)](http://haskell.cs.yale.edu/wp-content/uploads/2014/04/HSoM1.pdf) These are the existing tools/libraries to create computer music using haskell I found so far:
  • Euterpea:

    • successor of Haskore and HasSound
    • computer music library proposed by the paper "Haskell School Of Music - From Signals to Symphonies" (Paul Hudak)
  • Synthesizer

    • library for digital signal processing as proposed by the paper "Compiling Signal Processing Code embedded in Haskell via LLVM" (Henning Thielemann)
  • dsp

    • another library for signal processing by Henning Thielemann?

Suggestions about articles to read, persons to get in touch with, tools to take a look on would be greatly appreciated.

submitted by EsGeh
[link] [3 comments]
Categories: Incoming News

Haskell software engineering master thesis

haskell-cafe - Fri, 10/17/2014 - 11:07am
Hi, everyone! I'm about to write a software engineering/management master thesis at the IT University of Gothenburg, and I'm considering to do research into the Haskell world. It should probably be in one of the following five fields: empirical software engineering, requirements engineering, software architecture, model-driven engineering or quality management. The focus should probably be more towards an empirical study, rather than something more computer science-related. It should also add to general body of knowledge, and not be too tied to, for example, a specific implementation. Does anyone have any suggestions of relevant topics that I could write about, or perhaps some related papers that I could read? Thanks! Warm regards, Jon Kristensen _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

ICFEM 2014, Luxembourg, 3-7 November 2014: Last Call for Participation

General haskell list - Fri, 10/17/2014 - 10:45am
16th International Conference on Formal Engineering Methods ICFEM 2014, Luxembourg, 3-7 November 2014 Last Call for Participation http://icfem2014.uni.lu ---------------------------------------- The 16th International Conference on Formal Engineering Methods (ICFEM 2014) will be held at the Melia Hotel in Luxembourg, Luxembourg from 3rd November to 7 November 2014. Since 1997, ICFEM has been serving as an international forum for researchers and practitioners who have been seriously applying formal methods to practical applications. Highlights: ---------------------------------------- + Keynote speakers: Nikolaj Bjorner (Microsoft Research), Lionel Briand (University of Luxembourg) and Vincent Danos (University of Edinburgh) + The conference is now available http://icfem2014.uni.lu/program.php + Panel discussion on November 4th: Are Formal Engineering Methods and Agile Methods Friend or Enemy? + Two affiliated workshops FTSCS 2014 and SOFL+MSVL. PC Chairs ---------------------------------------- + Steph
Categories: Incoming News

Neil Mitchell - Downloads

del.icio.us/haskell - Fri, 10/17/2014 - 6:08am
Categories: Offsite Blogs

Neil Mitchell - Downloads

del.icio.us/haskell - Fri, 10/17/2014 - 6:08am
Categories: Offsite Blogs

Yosemite

haskell-cafe - Fri, 10/17/2014 - 3:49am
Hi, Has anybody tried GHC on Yosemite? I cannot afford to do it by myself this time. So, I would like to know. --Kazu
Categories: Offsite Discussion

Best way to Introduce FP into a dev team with many C,C++ and Java developers?

haskell-cafe - Fri, 10/17/2014 - 3:00am
Hi, Recently our development team had decided to attempt using Haskell or Scala as one of our programming language. (We had hoped some of our problem will be addressed through taking advantage of some element of FP, like immutability and Rx) Most of our team members have fairly good knowledge of C, C++ and Java. And few of them, including myself, have been self-studying a FP language like Haskell and Scala since last year. Besides some early starters, functional programming is quite new to us. When we held a lecture on FP, we found many of our developers were struggling in grasping some idea of FP. They fumbled with writing functional programming style code. We kept on lecturing several times, but still not quite successful. It seems more difficult than it looks - thinking in functional programming way for the long time C, C++ and Java developers. Does anyone had an experience with initiating FP adoption into a large dev team without pain? Our development team has around 300+ people. Thanks. _______
Categories: Offsite Discussion

Hiding import behaviour

glasgow-user - Thu, 10/16/2014 - 11:19pm
With the prelude changes that people have been discussing recently I've been wondering is there any reason why importing an identifier explicitly and unqualified doesn't automatically hide any implicit imports of the same identifier? Specifically I'm wondering about cases where you've imported an identifier explicitly from only one module, like this: module Foo (x, ...) where { ... } module Bar (x, ...) where { ... } import Bar import Foo (x) Even if you needed a pragma to enable it I can't think of any sensible reason why that shouldn't be equivalent to: import Bar hiding (x) import Foo (x) I don't know much of GHC's internals, but it seems like a pretty minimal change. Typing rules remain the same; explicit imports just shadow implicits. So importing multiple identifiers both implicitly or both explicitly would remain ambiguous.
Categories: Offsite Discussion

More about function equivalences?

Haskell on Reddit - Thu, 10/16/2014 - 9:19pm

There are a few notable transforms on functions that can be convenient: "tabulation":

(a -> b) ~> Set (a,b)

"classification":

Set (a,b) ~ ((a,b) -> Bool)

and "inverse image"

(a -> b) ~> (b -> Set a)

As far as I can tell, these don't fall exactly under the yoneda transform or classifying objects, but they seem suspiciously close. I see people throwing them around a lot but it's not clear to me under what circumstances (ie. what kind of category) this is possible. Is there a name for this relationship or a pointer to more tricks with it?

submitted by dogirardo
[link] [15 comments]
Categories: Incoming News