News aggregator

GHC.Generics and instances of Functor, Applicative, etc?

libraries list - Wed, 01/13/2016 - 3:28am
I'm using GHC.Generics and have noticed that the data types defined there don't have instances of the standard classes (at least not defined in that module), such as Functor, Applicative, Foldable and Traversable. It'd be very useful to be able to rely on such instances, so that one can define instances of custom types via instances of the generic types. (Hopefully, the compiler can remove most or all conversion overhead) Is there any reason not to add these generic instances?
Categories: Offsite Discussion

Core Spec

Haskell on Reddit - Tue, 01/12/2016 - 8:12pm
Categories: Incoming News

Yesod + ? for reactive web programming.

Haskell on Reddit - Tue, 01/12/2016 - 7:03pm

I'm looking to build a Reactive Web application and in Haskell. I've read through the Yesod book and some blog posts ( - this one to be specific) and it seems as though (correct me if I'm wrong) the Yesod Framework in 2012 wasn't really suitable for that. Have there been changes to that end? In fact a more basic question (excuse my naievity) is would Yesod work with with reactive libraries like Reactive banana to provide the same functionality as the Reactive Stocks example from Play + Scala (

What options to I have for client side interactivity in Yesod besides Angular and Fay as mentioned in the article?

submitted by ChavXO
[link] [8 comments]
Categories: Incoming News

Magnus Therning: Free play, part one

Planet Haskell - Tue, 01/12/2016 - 6:00pm

When I read John A De Goes post A Modern Architecture for FP I found it to be a bit too vague for me, but the topic was just interesting enough to finally push me to play a little with free monads. It’s not the first post I’ve read on the topic, there have been many before. None have quite managed to push me into actually doing something though!

A file API

To make it concrete but still short enough to not bore readers I came up with a small API for working with files:

data SimpleFileF a = LoadFile FilePath (String -> a) | SaveFile FilePath String a

The free monad wraps a functor, so here’s an implementation of that

instance Functor SimpleFileF where fmap f (LoadFile fp f')= LoadFile fp (f . f') fmap f (SaveFile fp d a) = SaveFile fp d (f a)

Now for some convenient functions to work with the API type

loadFile :: FilePath -> Free SimpleFileF String loadFile fp = liftF $ LoadFile fp id saveFile :: FilePath -> String -> Free SimpleFileF () saveFile fp d = liftF $ SaveFile fp d ()

With this in place I can write a somewhat more complex one

withSimpleFile :: (String -> String) -> FilePath -> Free SimpleFileF () withSimpleFile f fp = do d <- loadFile fp let result = f d saveFile (fp ++ "_new") result

Now I need a way to run programs using the API

runSimpleFile :: Free SimpleFileF a -> IO a runSimpleFile = foldFree f where f (LoadFile fp f') = liftM f' $ readFile fp f (SaveFile fp d r) = writeFile fp d >> return r

If this code was save in the file FreePlay.hs I can now convert it all to upper case by using

runSimpleFile $ withSimpleFile toUpper "FreePlay.hs"

which of course will create the file FreePlay.hs_new.

What have I bought so far?

Well, not much really.

So far it’s not much more than a rather roundabout way to limit what IO actions are available. In other words it’s not much more than what can be done by creating a limited IO, as in my earlier posts here and here.

Of course it would be possible to write another run function, e.g. one that doesn’t actually perform the file actions but just says what it would do. The nice thing though is, to use that same metaphor as John does, that I can add a layer to the onion. In other words, I can decorate each use of my SimpleFileF API with some other API. I think it was John’s description of this layering that pushed me to play with Free.

Categories: Offsite Blogs

MSFP 2016: Final Call for Papers

General haskell list - Tue, 01/12/2016 - 1:30pm
Sixth Workshop on MATHEMATICALLY STRUCTURED FUNCTIONAL PROGRAMMING 8 April 2016, in Eindhoven, The Netherlands A satellite workshop of ETAPS 2016 NOTE: the deadline for paper submissions has been extended by one day to: *Monday 18th January* Prior submission of an abstract is not required The sixth workshop on Mathematically Structured Functional Programming is devoted to the derivation of functionality from structure. It is a celebration of the direct impact of Theoretical Computer Science on programs as we write them today. Modern programming languages, and in particular functional languages, support the direct expression of mathematical structures, equipping programmers with tools of remarkable power and abstraction. Where would Haskell be without monads? Functional reactive programming without temporal logic? Call-by-push-value without adjunctions? The list goes on. This workshop is a forum for researchers who seek to reflect mathematical phenomena in data and con
Categories: Incoming News

Proposal: Add Peano numbers to base

libraries list - Mon, 01/11/2016 - 7:29pm
I have seen these redefined many times now. Examples: I often see them used as DataKinds. Too, operations on them can be lazy, which is sometimes useful. I filed a ticket: Discussion period: 2 weeks
Categories: Offsite Discussion

ANN: true-name released

General haskell list - Mon, 01/11/2016 - 6:40am
It is with some shame that I announce ‘true-name’, a package to assist one in violating those pesky module abstraction boundaries via the magick of Template Haskell. Take ‘Control.Concurrent.Chan’ for example; you can get your grubby mitts on the ‘Chan’ data constructor, despite it not being exported. Here we pattern match on it, and bind ‘chanR’ and ‘chanW’ to the ‘MVar’s containing the read and write ends of the channel respectively: Now, the type of ’chanR’ references the unexported ‘Stream’ and ‘ChItem’ types. We need the ‘ChItem’ data constructor―which is hidden under a few indirections—but that's not a problem: This gives us a rather dodgy ‘peekChan’. This sort of thing is usually a Bad Idea™, but may sometimes be more palatable than the alternatives. Full example: Taking another example, suppose we want the ‘Array’ type constructor hidde
Categories: Incoming News

Eq1, Ord1, Show1: move from eq1, compare1, showsPrec1 to liftEq, liftCompare, liftShowsPrec

libraries list - Sun, 01/10/2016 - 3:08pm
In transformers-0.5:Data.Functor.Classes class methods like eq1 are replaced by liftEq. With transformers-0.4 I could define: data T a = complicated definition ... deriving (Eq, Ord, Show) instance Eq1 T where eq1 = (==) instance Ord1 T where compare1 = compare instance Show1 T where showsPrec1 = showsPrec In transformers-0.5 it seems that I have to implement Eq1, Ord1, Show1 instances manually. Is there some assistance to define eq1 and compare1 for an ADT? What are the use cases where eq1 was not powerful enough and liftEq is needed?
Categories: Offsite Discussion

suppress warning "Defined but not used: type variable ‘x’" in GHC-8.0

glasgow-user - Sun, 01/10/2016 - 12:57am
GHC-8.0 emits several new warnings of this kind: Defined but not used: type variable ‘x’ for declarations like type instance Snd x y = y Enthusiastically, I started to replace unused type function arguments by underscores, only to find out that older GHC versions do not accept that. With what option can I disable this warning? Or can it be removed from -Wall for now?_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >
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