News aggregator

FunDeps and type inference

haskell-cafe - Tue, 04/14/2015 - 10:12pm
Dear cafe, I want to write an evaluation function that uncurries its function argument as necessary. Examples should include: eval :: (a -> b) -> a -> b eval :: (a -> b -> c) -> a -> (b -> c) eval :: (a -> b -> c) -> (a,b) -> c and hence have both eval (+) 4 5 eval (+) (4,5) typecheck. My approach is to use a type class: class Uncurry f a b where eval :: f -> a -> b instance Uncurry (a -> b) a b where eval = ($) instance (Uncurry f b c) => Uncurry ((->) a) f) (a,b) c where eval f (a,b) = eval (f a) b This works, but not for polymorphic arguments. One must annotate function and argument with concrete types when calling, otherwise the runtime does not know what instance to use. Type inference on ($) is able to infer the type of either of f, a or b in the expression b = f $ a if the type of two is known. Thus I am tempted to add functional dependencies class Uncurry f a b | f a -> b, a b -> f, f b -> a but I get scary errors: With only the first of the three dependencies, the coverage conditio
Categories: Offsite Discussion

Haddock and re-exports from other-modules

Haskell on Reddit - Tue, 04/14/2015 - 8:59pm

Supposing I have these modules:

module Private where a :: Int a = 3 module Public(module Public) where import Private as Public b :: Bool b = False

And the .cabal file has this:

exposed-modules: Public other-modules: Private

In Haskell, from another package, if I do "import Public" I get access to both "a" and "b". I cannot do "import Private". This is what I want. I am doing this to aggregate many modules with small interfaces (but possibly large implementations) into one module interface for import.

But the haddock documentation for my package shows only "b", not "a" for "Public". Am I doing something wrong? Is this a bug in haddock? What's the nicest workaround?

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

Proposal: Add exception info

libraries list - Tue, 04/14/2015 - 7:38pm
Control.Exception currently lacks a good way to supply extra information along with exceptions. For example, exceptions could be thrown along with their callstack[1] or implicit stack[2], but we have no generic way to include this information with exceptions. Proposed Solution ================= The proposed solution is to add a list of `SomeExceptionInfo` to the `SomeException` datatype. This list stores additional information about the exception. These `ExceptionInfo` instances use a mechanism which is pretty much identical to the dynamic way the `Exception` type works: data SomeException = forall e . Exception e => SomeExceptionWithInfo e [SomeExceptionInfo] data SomeExceptionInfo = forall a . ExceptionInfo a => SomeExceptionInfo a class Typeable a => ExceptionInfo a where displayExceptionInfo :: a -> String addExceptionInfo :: (ExceptionInfo a, Exception e) => a -> e -> SomeException addExceptionInfo x (toException -> SomeExceptionWithIn
Categories: Offsite Discussion

Brent Yorgey: Polynomial Functors Constrained by Regular Expressions

Planet Haskell - Tue, 04/14/2015 - 7:22pm

I’ve now finished revising the paper that Dan Piponi and I had accepted to MPC 2015; you can find a PDF here:

Polynomial Functors Constrained by Regular Expressions

Here’s the 2-minute version: certain operations or restrictions on functors can be described by regular expressions, where the elements of the alphabet correspond to type arguments. The idea is to restrict to only those structures for which an inorder traversal yields a sequence of types matching the regular expression. For example, gives you even-size things; gives you the derivative (the structure has a bunch of values of type , a single hole of type , and then more values of type ), and the dissection.

The punchline is that we show how to use the machinery of semirings, finite automata, and some basic matrix algebra to automatically derive an algebraic description of any functor constrained by any regular expression. This gives a nice unified way to view differentiation and dissection; we also draw some connections to the theory of divided differences.

I’m still open to discussion, suggestions, typo fixes, etc., though at this point they won’t make it into the proceedings. There’s certainly a lot more that could be said or ways this could be extended further.

Categories: Offsite Blogs

Bed & Breakfast maintainer?

libraries list - Tue, 04/14/2015 - 6:05pm
Anyone out there maintaining (or willing to take over) the bed-and-breakfast package? 0.4.3 (the latest release) doesn't compile with 7.8 because of the changes to Typeable. The git repo has fixes for this in it, along with some other stuff, but that's nearly a year old, and hasn't been released yet. My requests to the author & maintainer (Julian Fleischer < julian.fleischer< at >>) have gone unanswered. _______________________________________________ Libraries mailing list Libraries< at >
Categories: Offsite Discussion

Mark Jason Dominus: I'm old

Planet Haskell - Tue, 04/14/2015 - 6:00pm

This week I introduced myself to Recurse Center, where I will be in residence later this month, and mentioned:

I have worked as a professional programmer for a long time so I sometimes know strange historical stuff because I lived through it.

Ms. Nikki Bee said she wanted to hear more. Once I got started I had trouble stopping.

I got interested in programming from watching my mom do it. I first programmed before video terminals were common. I still remember the smell of the greasy paper and the terminal's lubricating oil. When you typed control-G, the ASCII BEL character, a little metal hammer hit an actual metal bell that went "ding!".

I remember when there was a dedicated computer just for word processing; that's all it did. I remember when hard disks were the size of washing machines. I remember when you could buy magnetic cores on Canal Street, not far from where Recurse Center is now. Computer memory is still sometimes called “core”, and on Unix your program still dumps a core file if it segfaults. I've worked with programmers who were debugging core dumps printed on greenbar paper, although I've never had to do it myself.

I frequented dialup BBSes before there was an Internet. I remember when the domain name system was rolled out. Until then email addresses looked like yuri@kremvax, with no dots; you didn't need dots because each mail host had a unique name. I read the GNU Manifesto in its original publication in Dr. Dobb's. I remember the day the Morris Worm hit.

I complained to Laurence Canter after he and his wife perpetrated the first large scale commercial spamming of the Internet. He replied:

People in your group are interested. Why do you wish to deprive them of what they consider to be important information??

which is the same excuse used by every spammer since.

I know the secret history of the Java compiler, why Java 5.0 had generics even though Sun didn't want them, and why they couldn't get rid of them. I remember when the inventors of LiveScript changed its name to JavaScript in a craven attempt to borrow some of Java's buzz.

I once worked with Ted Nelson.

I remember when Sun decided they would start charging extra to ship C compilers with their hardware, and how the whole Internet got together to fund an improved version of the GNU C compiler that would be be free and much better than the old Sun compiler ever was.

I remember when NCSA had a web page, updated daily, called “What's New on the World Wide Web”. I think I was the first person to have a guest book page on the Web. I remember the great land rush of 1996 when every company woke up at the same time and realized it needed a web site.

I remember when if you were going to speak at a conference, you would mail a paper copy of your slides to the conference people a month before so they could print it into books to hand out to the attendees. Then you would photocopy the slides onto plastic sheets so you could display them on the projector when you got there. God help you if you spilled the stack of plastic right before the talk.

tl;dr i've been around a while.

However, I have never programmed in COBOL.

(I'm not actually very old, but I got started very young.)

Categories: Offsite Blogs

[ANN] bower-json: read bower.json from Haskell

Haskell on Reddit - Tue, 04/14/2015 - 5:12pm

I just made a little library for parsing bower.json files in Haskell. I'd appreciate any feedback:

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

Final CFP - SBLP 2015: 19th Brazilian Symposium onProgramming Languages

General haskell list - Tue, 04/14/2015 - 3:47pm
FINAL CALL FOR PAPERS - SBLP 2015 19th Brazilian Symposium on Programming Languages 21-26 September 2015 Belo Horizonte, Brazil *** DEADLINE APPROACHING *** +++++++++++++++++++++++++++++++++++++++++++++++++++ IMPORTANT DATES Abstract submission: 20 April, 2015 Paper submission: 27 April, 2015 Author notification: 18 June, 2015 Camera ready deadline: 2 July 2015 INTRODUCTION The Brazilian Symposium on Programming Languages is a well-established symposium which provides a venue for researchers and practitioners interested in the fundamental principles and innovations in the design and implementation of programming languages and systems. SBLP 2015 is part of 6th Brazilian Conference on Software: Theory and Practice, CBSoft 2015, that will be held in Belo Horizonte, Minas Gerais, Brazil, from September 21st to September 26th, 2015. Authors are invited to submit original research on any relevant topic which can be either in the form of regular or short papers. TOPICS Topic
Categories: Incoming News

Submitting a conflicting package to Hackage

Haskell on Reddit - Tue, 04/14/2015 - 3:10pm

Basically, I've written a small library mimicking the functionality of [Control.Concurrent.Async][], with a few notable differences.

I'm currently calling this library Control.Concurrent.FutureIO and this is currently how I plan to submit the package to Hackage. Currently, there are only two functions that exist as a part of the API, async :: IO a -> FutureIO a and await :: FutureIO a -> IO a, instead of Async' s functions async :: IO a -> IO (Async a) and wait :: IO (Async a) -> IO a.

The benefit of my implementation (in my eyes) is that FutureIO is an instance of the Functor/Applicative/Monad classes and it composes neatly. For instance, the following code will only take ~1s instead of 3s to complete.

wait1s = threadDelay 1000000 slowMulti = async $ wait1s >> return (*) slowProd1 = async $ wait1s >> return 42 slowProd2 = async $ wait1s >> return 24 await $ slowMulti <*> slowProd1 <*> slowProd2

Ignoring this incredibly trivial example, in my eyes this has a pretty strong benefit over the Control.Concurrent.Async package. My question is "Is there a better way for me to submit this than just under the FutureIO moniker?"

*(note: As a Haskell newbie, I'm fully aware that this could be dumb, redundant, etc. and I would love it if you told me so I could learn)

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

The GHC Team: GHC Weekly News - 2015/04/14

Planet Haskell - Tue, 04/14/2015 - 11:44am

Hi *,

It's been a few weeks since the last news bulletin - your editor apologizes about that. It's actually been a relatively slow few weeks here too, and busy-ness outside of GHC has attracted some of my attention. Despite that, GHC 7.10.1 was released, a new HP alpha is out, and things are moving along smoothly. Now that the release is done, things are quitely moving along in HEAD - with people committing code with reckless abandon, of course.

This week, GHC HQ met up, but it's been very light since the 7.10.1 release. Currently there isn't anything pushing us to do a 7.10.2 release at least for a few more weeks it looks like - but see below.

  • We puzzled a bit about the release status of 7.10.2, and thought: it's only holding up people who are depending on it. So, who's depending on it, and what do they need fixed? See below for more.
  • We also talked a bit about performance - it seems the compiler has been getting much slower over time since the 7.8.x release series, and it's time to reign it in. Austin will be spending his week investigating a bit of this, and the causes.
7.10.2 Status

So, you may be wondering when the 7.10.2 release is. The trick is it happens when you tell us it should happen!

So far, taking a look at milestone:7.10.2, we've fixed about half the bugs we currently have marked down to fix. But we're probably going to punt some of those - and we're not sure all the ones that are there should be.

So this is a call: If you need something to be fixed during 7.10.2, please file a ticket, set the milestone, and alert us. The sooner the better, because it'll inform us as to when we should release. Emailing is also a sure-fire way to get our attention.

And remember: you can always find out the latest about the next release at the Status page (in this case, for 7.10.2) - ​

Call for help: DocBook to AsciiDoc

The GHC team needs some help. A few months ago, we put out a poll to convert our DocBook-based manual to AsciiDoc.

The poll had a mostly lukewarm reception, with the idea that it will A) make life easier for people who frequently modify the users guide, and B) make life easier for people who add things irregularly, as a lower barrier to entry.

It looks like we still want to do this - but alas, many of us don't have time!

So, we're asking the public: Is anyone willing to step up and help here? For example, it may be possible to get a long ways with just pandoc, but we need someone to finish it - and in return, we'll help along the way!

List chatter
  • A GHC user, Dave, asked the list about some questions with Cross Compilation, as he's attempting to get GHC to work natively inside the Open Embedded build environment. Unfortunately, things haven't been going well so far, and any input from enterprising hackers is appreciated: ​
  • Dan Aloni has started a discussion about improving GHC's error messages, spurred by a popular blog post he wrote and posted on Reddit about some Happy/GHC improvements he's made. This is a difficult area (error messages in general are hard) to work on, so thanks to Dan for helping! ​
  • Tamar Christina started a thread about replacing ghc-split, an old Perl script inside GHC, but he wanted to know: what do we do about a regex replacement? Mikhail Glushenkov spoke up about a similar decision the LLVM developers used: to use the OpenBSD regex implementation. ​
Noteworthy commits Closed tickets

#10222, #10219, #8057, #10226, #10220, #9723, #10230, #10208, #10236, #10213, #10231, #10240, #10243, #10237, #10224, #8811, #10197, #10252, #9958, #10253, #8248, #10207, #10214, #9964, #10194, #10251, #10188, #10257, #10247, #10247, #9160, #10259, #9965, #10265, #10264, #10286, #10282, #10290, #10291, #10300, #9929, #8276, #10218, #10148, #10232, #10274, #10275, #10195, and #10233.

Categories: Offsite Blogs

Swap type class

Haskell on Reddit - Tue, 04/14/2015 - 10:57am
Categories: Incoming News

Generalized swap

Haskell on Reddit - Tue, 04/14/2015 - 10:51am
Categories: Incoming News

Dimitri Sabadie: Generalized swap

Planet Haskell - Tue, 04/14/2015 - 8:31am
Generalized swap

I pushed a pull request to Edward Kmett’s either package to implement two functions some guys was complaining not to find: flipEither :: Either e a -> Either a e and flipEitherT :: EitherT e m a -> EitherT a m e.

When implementing the functions, I wondered: “Hey, flipping stuff is a pretty common operation. Don’t we have an abstraction for that yet?”. I haven’t found any.

Meet Swap

I decided to make a little typeclass to see what it’d be.

class Swap s where
swap :: s a b -> s b a

instance Swap (,) where
swap (a,b) = (b,a)

instance Swap Either where
swap = flipEither

-- let’s go wild and fooled
instance Swap Map where
swap = fromList . fmap swap . toList

If you think that’s handy, I’ll write a little package with default instances to make it live.

Happy hacking folks!

Categories: Offsite Blogs

Philip Wadler: Codes that changed the world

Planet Haskell - Tue, 04/14/2015 - 7:04am
Aleks Krotoski tackles programming languages in BBC Radio 4's Codes that Changed the World. The five episodes comprise: Fortran, Cobol, Basic, Java, and The Tower of Babel. Functional programming and Haskell are singled out for special attention in the final programme, which includes a interview with Haskell developer Elise Huard; online is a clip of interview with Simon Peyton Jones that did not make it on air.

Categories: Offsite Blogs

FP Complete: Announcing: stackage-view

Planet Haskell - Tue, 04/14/2015 - 5:20am

As part of our announcement of open sourcing ide-backend, there was a video demonstrating a tool called “fpview” (that was our internal name for this tool).

<iframe allowfullscreen="allowfullscreen" frameborder="0" height="315" src="" width="420"></iframe>

Like many of our tools, after some internal development, we're now releasing it open source here at: stackage-view.

It looks like this:

The README documents the features, but here's a quick rundown:

  • Go to definition: You can double-click any identifier to jump straight to the definition.
  • Type information of any expression or pattern binding. Just click any identifier to see its type. Alternatively, you can select an expression to see the type of that. Hitting the <-> expansion button will expand the selection to a parent node.

The first purpose behind the tool was to target general teams of people who may not all be using the same tooling (Haskellers are like cats, they prefer to do their own thing!), some users may be on Emacs, Vim, or Sublime, FP Eclipse, Leksah, etc. whereas this read-only tool serves as a way to inspect a codebase with handy information and jumping available.

The second purpose was to serve as a demonstration and acid test for our combination GHCJS and React library ghcjs-react. It makes for a nice simple-but-non-trivial demonstration of the library. There is real-world state handling going on, interacting with third-party APIs (aside from React itself, the Ace editor).

It also serves as a demonstration of using ide-backend programmatically. If you look in the source of stackage-view you'll see it's quite straight-forward to use. To build it, you will need the Git version of ide-backend found here. Currently it cannot be uploaded to Hackage due to an issue with the -dynamic flag.

Categories: Offsite Blogs

New maintainer for wl-pprint

Haskell on Reddit - Tue, 04/14/2015 - 4:23am
Categories: Incoming News