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

2012-10-23 Thread Tony Morris
As a side note, I think a direct superclass of Functor for Monad is not a good idea, just sayin' class Functor f where fmap :: (a -> b) -> f a -> f b class Functor f => Apply f where (<*>) :: f (a -> b) -> f a -> f b class Apply f => Bind f where (=<<) :: (a -> f b) -> f a -> f b class Ap

Re: [Haskell-cafe] A clarification about what happens under the hood with foldMap

2012-10-23 Thread Alfredo Di Napoli
Thanks guys for the clarification, this blowed my mind a bit :P As far as I understood, is that my initial thought about Sum and Product was wrong; in fact, they don't even participate to the party! This is confirmed by the Oleg's paradox about (-). What really happens is that Endo (which I guess i

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

2012-10-23 Thread Kim-Ee Yeoh
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 erroneously written ε in some previous mail) defines a > monad (and requires some

Re: [Haskell-cafe] A clarification about what happens under the hood with foldMap

2012-10-23 Thread John Lato
> From: Alfredo Di Napoli > Subject: [Haskell-cafe] A clarification about what happens under the > hoodwith foldMap > > I'm sure I'm missing a point, but the "minimum" definition for a Foldable > instance is given in terms of foldMap, so I get the cake for free, foldr > included, right

Re: [Haskell-cafe] Help: Main: thread blocked in MVar operation

2012-10-23 Thread Joey Adams
On Tue, Oct 23, 2012 at 5:03 PM, "José A. Lopes" wrote: > Hey everyone, > > I changed my code I now I get the following error message > Main: thread blocked indefinitely in an MVar operation > > Before the change, I was using the State monad with runState. > Then, I changed the code to use the

[Haskell-cafe] Help: Main: thread blocked in MVar operation

2012-10-23 Thread José A. Lopes
Hey everyone, I changed my code I now I get the following error message Main: thread blocked indefinitely in an MVar operation Before the change, I was using the State monad with runState. Then, I changed the code to use the StateT monad transformer wrapped around IO monad and runStateT. A

Re: [Haskell-cafe] Hackage Package Discoverability

2012-10-23 Thread Gwern Branwen
On Tue, Oct 23, 2012 at 1:53 AM, Myles C. Maxfield wrote: > Is there a better way to make this algorithm discoverable? How about deprecation pragmas? http://www.haskell.org/ghc/docs/7.2.2/html/users_guide/pragmas.html -- gwern http://www.gwern.net __

[Haskell-cafe] Haskell job opening at Functor AB

2012-10-23 Thread Alp Mestanogullari
Hello -cafe, There's a very cool Haskell job opening at Functor AB, involving some cool type theory, for use in nuclear fusion research. You can read about it here: http://alpmestan.com/posts/2012-10-23-haskell-job-opening-at-functor.html -- Alp Mestanogullari __

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

2012-10-23 Thread Daniel van den Eijkel
Hi, I can't say anything about HSQL, but I use HDBC and I'm happy with it. [1] says it's the most popular database for Haskell. Best, Daniel [1] http://en.wikibooks.org/wiki/Haskell/Database Am 10/23/12 4:21 PM, schrieb Johannes Waldmann: Hi. I am using hsql-(mysql-)1.8.2 When compiled wit

Re: [Haskell-cafe] A clarification about what happens under the hood with foldMap

2012-10-23 Thread Alfredo Di Napoli
Thanks guys, I'll work my way through Oleg's paradox as well as what you just said Chaddai. I'm very busy right now, but I'll probably come back to you tomorrow morning, when I'll have an hour to think freely :) Cheers, A. ___ Haskell-Cafe mailing list H

[Haskell-cafe] hsql-mysql encoding issues

2012-10-23 Thread Johannes Waldmann
Hi. I am using hsql-(mysql-)1.8.2 When compiled with ghc-7.6, the resulting executable does not seem to be able to read strings from the DB correctly (umlauts do "vanish") while it worked with hsql-(mysql-)1.8.1 and ghc-7.4. the mysql server says (show variables) | character_set_client

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

2012-10-23 Thread Brent Yorgey
On Thu, Oct 18, 2012 at 11:49:08PM +0530, niket wrote: > I am a novice in Haskell but I would love to see the gurus out here > teaching Haskell on MOOCs like Coursera or Udacity. > > Dr Martin Odersky is doing it for Scala here: > https://www.coursera.org/course/progfun > > I would love to see Ha

Re: [Haskell-cafe] A clarification about what happens under the hood with foldMap

2012-10-23 Thread Chaddaï Fouché
On Tue, Oct 23, 2012 at 10:36 AM, Alfredo Di Napoli wrote: > I'm sure I'm missing a point, but the "minimum" definition for a Foldable > instance is given in terms of foldMap, so I get the cake for free, foldr > included, right? > In the example I have defined my treeSum as: > > treeSum = Data.Fol

[Haskell-cafe] A clarification about what happens under the hood with foldMap

2012-10-23 Thread oleg
> I was playing with the classic example of a Foldable structure: Trees. > So the code you can find both on Haskell Wiki and LYAH is the following: > > data Tree a = Empty | Node (Tree a) a (Tree a) deriving (Show, Eq) > > instance Foldable Tree where > foldMap f Empty = mempty > foldMap f

[Haskell-cafe] A clarification about what happens under the hood with foldMap

2012-10-23 Thread Alfredo Di Napoli
-- Forwarded message -- From: Alfredo Di Napoli Date: 23 October 2012 10:35 Subject: Re: [Haskell-cafe] A clarification about what happens under the hood with foldMap To: Chaddaï Fouché I'm sure I'm missing a point, but the "minimum" definition for a Foldable instance is given i

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

2012-10-23 Thread oleg
Andreas Abel wrote: > I tell them that monads are for sequencing effects; and the > sequencing is visible clearly in > >(>>) :: IO a -> IO b -> IO b >(>>=) :: IO a -> (a -> IO b) -> IO b > > but not in > >fmap :: (a -> b) -> IO a -> IO b >join :: IO (IO a) -> IO a Indeed! I'd lik

Re: [Haskell-cafe] A clarification about what happens under the hood with foldMap

2012-10-23 Thread Chaddaï Fouché
Le 23 oct. 2012 09:54, "Alfredo Di Napoli" a écrit : > > What this code does is straighforward. I was struck from the following sentences in LYAH: > >> Notice that we didn't have to provide the function that takes a value and returns a monoid value. >> We receive that function as a parameter to fo

Re: [Haskell-cafe] A yet another question about subtyping and heterogeneous collections

2012-10-23 Thread oleg
> And HList paper left me with two questions. The first one is how much > such an encoding costs both in terms of speed and space. And the > second one is can I conveniently define a Storable instance for > hlists. As I said before, I need all this machinery to parse a great > number of serialized

[Haskell-cafe] A clarification about what happens under the hood with foldMap

2012-10-23 Thread Alfredo Di Napoli
Hi Cafe, I was playing with the classic example of a Foldable structure: Trees. So the code you can find both on Haskell Wiki and LYAH is the following: data Tree a = Empty | Node (Tree a) a (Tree a) deriving (Show, Eq) instance Foldable Tree where foldMap f Empty = mempty foldMap f (Nod

Re: [Haskell-cafe] Hackage Package Discoverability

2012-10-23 Thread Myles C. Maxfield
The last revision of the encoding package (0.6.7.1) was uploaded 6 days ago, so it's certainly not old. The package is also not unwieldly: the functions (runPut . encode punycode) and (runGet (decode punycode)) are equivalent to my 'encode' and 'decode' functions. In addition, it supports many more