Re: [Haskell-cafe] generalizing the writer monad

2012-10-24 Thread Petr P
Hi, thanks for your interesting ideas an inspiring answers. However I meant something a bit different. My point wasn't how to implement this problem with the current set of tools. Instead, I was wondering if it'd be worth expanding the current Reader/Writer library. Best regards, Petr 201

Re: [Haskell-cafe] hsql-mysql encoding issues

2012-10-24 Thread Johannes Waldmann
Daniel van den Eijkel gmx.net> writes: > ... but I use HDBC and I'm happy with it. including its handling of character encodings? (That is, do you have, e.g., texts with umlauts in your data?) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.or

Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?

2012-10-24 Thread AUGER Cédric
Le Wed, 24 Oct 2012 12:36:52 +0700, Kim-Ee Yeoh a écrit : > On Tue, Oct 16, 2012 at 9:37 PM, AUGER Cédric > wrote: > > > As I said, from the mathematical point of view, join (often noted μ > > in category theory) is the (natural) transformation which with > > return (η that I may have erroneous

[Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread Jon Fairbairn
Is there a convenient way of handling a data structure with lots of fields of different types that may or may not be filled in? Something equivalent to data D = D {a::Maybe A, b::Maybe B, c::Maybe C, …} but with better space efficiency and a more convenient empty object. An easy alternative is

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread Roman Cheplyaka
* Jon Fairbairn [2012-10-24 11:08:29+0100] > Is there a convenient way of handling a data structure with lots > of fields of different types that may or may not be filled in? > > Something equivalent to > > data D = D {a::Maybe A, b::Maybe B, c::Maybe C, …} > > but with better space efficiency

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread Daniel Trstenjak
Hi Jon On Wed, Oct 24, 2012 at 11:08:29AM +0100, Jon Fairbairn wrote: > for each field, which is tedious (and O(n)). Obviously Templates > would help, but is there an alternative I’ve missed? perhaps something like: data Type = Ta | Tb | Tc ... data E= Ea A | Eb B | Ec C | ... type D=

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread Roman Cheplyaka
* Roman Cheplyaka [2012-10-24 13:55:17+0300] > * Jon Fairbairn [2012-10-24 11:08:29+0100] > > Is there a convenient way of handling a data structure with lots > > of fields of different types that may or may not be filled in? > > > > Something equivalent to > > > > data D = D {a::Maybe A, b::Ma

Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?

2012-10-24 Thread Alberto G. Corona
What hiders according with my experience, the understanding of this generalization are some mistakes. two typical mistakes from my side was to consider an arrow as a function, and the consideration of m as a kind of container, which it is not from the point of view of category theory. a -> m b

Re: [Haskell-cafe] Maximum bipartite matching: 24 lines

2012-10-24 Thread Stefan Klinger
On 2012-Oct-22 14:23 (-0700), Eugene Kirpichov wrote with possible deletions: > > fwd = foldr (\(x,y) -> M.insertWith (++) x [y]) M.empty $ S.toList g > > Use foldl' here, foldr is absolutely useless here and it only consumes > the stack space as your operation is strict. Thank you very much

Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?

2012-10-24 Thread Alberto G. Corona
The particular case from which the former is a generalization: *instance Monad m => Monoid (a -> a) where* *mappend = (.)* *mempty = id* * * Here the monoid is defined for the functions within the set of values of type a. There are no null elements. 2012/10/24 Alberto G. Corona > W

Re: [Haskell-cafe] hsql-mysql encoding issues

2012-10-24 Thread Daniel van den Eijkel
So far I used HDBC with mysql and sqlite3, in both cases with UTF8 encoded data (filenames including chinese characters, umlauts etc, e.g.). (After connecting to mysql, I use the statement "set names utf8"; sqlite does not need this) Am 10/24/12 11:10 AM, schrieb Johannes Waldmann: Daniel va

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread Twan van Laarhoven
On 24/10/12 12:08, Jon Fairbairn wrote: Is there a convenient way of handling a data structure with lots of fields of different types that may or may not be filled in? Not sure about convenience, but here is a type safe solution with O(log n) lookups and updates. The idea is to define a GADT

Re: [Haskell-cafe] serialize an unknown type

2012-10-24 Thread Corentin Dupont
I'm trying to get around my problem (still stuck...). I have really to call a function like this: triggerEvent :: (Typeable e, Show e, Eq e) => Event e -> EventData e -> State Game () This function simply execute an event given the corresponding data and change the state of the game. Now as explai

[Haskell-cafe] ANN: Cabal-1.16.0.2 and cabal-install-1.16.0.1

2012-10-24 Thread Johan Tibell
Hi, On behalf of the cabal contributors, I'm proud to announce bugfix releases of Cabal and cabal-install. Here's a complete list of changes since the last release: Since Cabal-1.16.0.1: * Bump Cabal version number to 1.16.0.2 * Fixed warnings on the generated Paths module. The warnings are gene

Re: [Haskell-cafe] ANN: Cabal-1.16.0.2 and cabal-install-1.16.0.1

2012-10-24 Thread Alfredo Di Napoli
Thanks Johan and thanks to all the guys behind Cabal :) Cheers, A. On Wed, Oct 24, 2012 at 09:42:48AM -0700, Johan Tibell wrote: > Hi, > > On behalf of the cabal contributors, I'm proud to announce bugfix > releases of Cabal and cabal-install. Here's a complete list of changes > since the last

Re: [Haskell-cafe] serialize an unknown type

2012-10-24 Thread Stephen Tetley
Hi Corentin It looks like you are writing the event handler on the server side. If so, the range of events you can handle is fixed to just those you implement handlers for - having an openly extensible event type is useless if this is the case. Ignoring client/server for a moment, a function (Sta

[Haskell-cafe] Online haskell course

2012-10-24 Thread graham
Anyone know of a similar course to the coursera scala one for haskell ? https://www.coursera.org/course/progfun Quite interesting online course that has graded assignments. Anything similar or anyone considering doing something similar for haskell ? Thanks Graham __

Re: [Haskell-cafe] Online haskell course

2012-10-24 Thread Richard Wallace
In case you haven't seen it, there is an intro to Haskell video series by Erik Meijer on Channel9. There aren't any graded assignments or anything like that, but I found it to be excellent without those. [1] http://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Functional-Programming-Fundamenta

[Haskell-cafe] Cabalizing LVM

2012-10-24 Thread Jurriaan Hage
Dear all, in an effort to Cabalize the Helium compiler and make it available on Hackage, it would be helpful to have an example of a Cabal file that shows how to deal with compilation of platform dependent C-code. Anybody out there who has a sample for me? best, Jurriaan Hage

Re: [Haskell-cafe] Teaching Haskell @ MOOCs like Coursera or Udacity

2012-10-24 Thread Eric Rasmussen
I can see that the required effort would be prohibitive, but after thinking about this some more I do think there are a couple of nice advantages: 1) Quizzes and graded assignments offer some structure to self study, and having some form of feedback/validation when you first get started is helpful

Re: [Haskell-cafe] Teaching Haskell @ MOOCs like Coursera or Udacity

2012-10-24 Thread David McBride
I'm taking it primarily because it is taught by the guy who made the language. I mean how cool is that? He is very smart and certainly blows any other lecturer I've ever had out of the water. If SPJ were doing a haskell course I'd sign up for that too in a heart beat. There's also a slim possib

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread AntC
Jon Fairbairn cl.cam.ac.uk> writes: > > > Is there a convenient way of handling a data structure with lots > of fields of different types that may or may not be filled in? > Hi Jon, if your question had appeared in a database forum, the answer would be ... Sounds like you need to do normal-

Re: [Haskell-cafe] testing if values can be applied to polymorphic functions

2012-10-24 Thread Michael Sloan
Hey! I was doing similar things with my project "haskellion" ( which I know you've seen because you're the only one that's commented on it - http://www.youtube.com/watch?v=gn_ZZiXVlNY&feature=plcp ). I'm not planning on getting back to work on it anytime soon (there's way too much Haskell stuff I

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread David Thomas
You've got a bunch of great answers, if there's no rhyme or reason to which fields are missing. If, on the other hand, they will tend to be present or absent in groups, you could decompose your data-structure a bit, for fast lookups, good space efficiency, and maybe even slightly more interesting

Re: [Haskell-cafe] Cabalizing LVM

2012-10-24 Thread Sai Hemanth K
Hi, Here are two examples: a) unix-compat has one: https://github.com/jystic/unix-compat/blob/master/unix-compat.cabal and b) Network library has a platform specific cabal: https://github.com/haskell/network/blob/master/network.cabal Kindly note that network also expects a configure script to run