[Haskell-cafe] Munich Haskell Meeting

2013-05-28 Thread Heinrich Hördegen
Dear all, once again, our monthly Haskell Meeting in Munich will take place. We meet on Thursday, 30 of May, 19h30. The venue is as usually, Cafe Puck. Please go here for details and click the button if you plan to join: http://www.haskell-munich.de/dates Have a successful day! Heinrich

[Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Dominique Devriese
Hi all, I often find myself needing the following definitions: mapPair :: (a - b) - (c - d) - (a,c) - (b,d) mapPair f g (x,y) = (f x, g y) mapFst :: (a - b) - (a,c) - (b,c) mapFst f = mapPair f id mapSnd :: (b - c) - (a,b) - (a,c) mapSnd = mapPair id But they seem missing from the

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Benjamin Edwards
You might want to look at the arrow type class and the instance for (-). Ben On 28 May 2013 09:56, Dominique Devriese dominique.devri...@cs.kuleuven.be wrote: Hi all, I often find myself needing the following definitions: mapPair :: (a - b) - (c - d) - (a,c) - (b,d) mapPair f g (x,y)

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Tikhon Jelvis
These are present in Control.Arrow as (***), first and second respectively. They are easy to overlook because they work for *all* arrows, not just functions. So the type signatures look like: first :: Arrow a = a b c - a (b, d) (c, d) If you replace a with (-), you'll see that this is

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Gregory Collins
On Tue, May 28, 2013 at 10:54 AM, Dominique Devriese dominique.devri...@cs.kuleuven.be wrote: Hi all, I often find myself needing the following definitions: mapPair :: (a - b) - (c - d) - (a,c) - (b,d) mapPair f g (x,y) = (f x, g y) That's Control.Arrow.(***), e.g.: ghci (+3)

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Andrew Butterfield
I have them defined for my stuff. Generally I find it much quicker to roll my own than to (1) ask on this list if someone else has done it... (2) look at arrows or MyFavouriteCategoryTheoryBitOfFPBecauseICantGetAbstractEnough and the try to figure out what is going on. The joy of Haskell

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Dominique Devriese
2013/5/28 Tikhon Jelvis tik...@jelv.is: These are present in Control.Arrow as (***), first and second respectively. Right, thanks. Strange that neither Hayoo nor Hoogle turned these up.. Dominique ___ Haskell-Cafe mailing list

[Haskell-cafe] Generalizing unionWithKey, unionWith, ...

2013-05-28 Thread Jose A. Lopes
Hello everyone, unionWithKey and unionWith have the following types unionWith :: Ord k = (a - a - a) - Map k a - Map k a - Map k a unionWithKey :: Ord k = (k - a - a - a) - Map k a - Map k a - Map k a Since they are implemented by means of mergeWithKey, wouldn't it be possible to generalize

Re: [Haskell-cafe] Generalizing unionWithKey, unionWith, ...

2013-05-28 Thread Johannes Waldmann
Jose A. Lopes jose.lopes at ist.utl.pt writes: unionWith :: Ord k = (a - b - c) - Map k a - Map k b - Map k c what should be the result of unionWith undefined (M.singleton False 42) (M.singleton True bar) ? perhaps you mean intersectionWith, which already has the type you want. -

Re: [Haskell-cafe] Generalizing unionWithKey, unionWith, ...

2013-05-28 Thread Jose A. Lopes
Yes! intersectionWith is just what I needed. In any case, coming back to your example, why would you want to use undefined in that particular case? What makes it an interesting example ? Best, Jose On 28-05-2013 12:32, Johannes Waldmann wrote: Jose A. Lopes jose.lopes at ist.utl.pt writes:

Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-05-28 Thread Dominic Steinitz
Hi Edward, Although the project I am interested in (as a user) has been accepted :-), I can't help feeling the selection process is a bit opaque. Is it documented somewhere and I just missed it? Apologies if I did. BTW I appreciate all the hard work that goes into the selection process.

Re: [Haskell-cafe] Generalizing unionWithKey, unionWith, ...

2013-05-28 Thread Johannes Waldmann
Jose A. Lopes jose.lopes at ist.utl.pt writes: What makes it an interesting example ? it shows that your proposed type for unionWith is not reasonable. why would you want to use undefined in that particular case? the two argument maps have disjoint key sets, so the combining function will

[Haskell-cafe] Type classes

2013-05-28 Thread Johannes Gerer
Dear Haskellers, While trying to understand the interconnection and hierarchy behind the important typeclasses, I stumbled upon the following question that I am not able to answer: There seems to be a hierachy of the type classes, in the sense, that the more powerfull a class is, the more

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Anton Kholomiov
I don't understand the final part of the question but here are some comments for the first part. I don't like the phrase: the more powerfull a class is, the more fleixblility you have for combining them to complex programs powerfull, more flexibility, complex programs -- are not so precise

Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread Kristopher Micinski
I'm also interested in seeing this. Have you ported the Haskell runtime to Android? It seems like this should be able to be done, and through the JNI it seems like you should be able to get the system API (albeit, ugly). However, I'd be really happy to see this setup if you were willing to put

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Petr Pudlák
Dne 28.5.2013 10:54, Dominique Devriese napsal(a): Hi all, I often find myself needing the following definitions: mapPair :: (a - b) - (c - d) - (a,c) - (b,d) mapPair f g (x,y) = (f x, g y) mapFst :: (a - b) - (a,c) - (b,c) mapFst f = mapPair f id mapSnd :: (b - c) - (a,b) -

Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread Kristopher Micinski
I guess you can't really go from native - framework code like this, so this would really make sense only for native methods that are self contained. Is this right? It seems like this would imply that you can only write parts of an app's computation in Haskell, not the whole thing. But maybe I'm

Re: [Haskell-cafe] ANN: Haskell Platform 2013.2.0.0

2013-05-28 Thread harry
Good to see it released! Was there a deliberate decision not to build a Windows x64 platform, or is it just that there wasn't anyone to do it? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Andreas Abel
See Agda.Utils.Tuple :-) -- | Bifunctoriality for pairs. (-*-) :: (a - c) - (b - d) - (a,b) - (c,d) (f -*- g) ~(x,y) = (f x, g y) -- | @mapFst f = f -*- id@ mapFst :: (a - c) - (a,b) - (c,b) mapFst f ~(x,y) = (f x, y) -- | @mapSnd g = id -*- g@ mapSnd :: (b - d) - (a,b) - (a,d) mapSnd g ~(x,y)

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Emil Axelsson
`mapPair` also exists as `tup2` in patch-combinators: http://hackage.haskell.org/package/patch-combinators / Emil 2013-05-28 16:01, Andreas Abel skrev: See Agda.Utils.Tuple :-) -- | Bifunctoriality for pairs. (-*-) :: (a - c) - (b - d) - (a,b) - (c,d) (f -*- g) ~(x,y) = (f x, g y) -- |

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Johannes Gerer
Thank you for the comments on the first part. While one can argue about the different meanings of powerful and flexible here, that's not the question. The question is, about showing A = B using wrappers like Kleisli or Cokleisli: I can use Kleisli to show that a Monad can do everything an

Re: [Haskell-cafe] Generalizing unionWithKey, unionWith, ...

2013-05-28 Thread Petr Pudlák
Dne 28.5.2013 12:32, Johannes Waldmann napsal(a): Jose A. Lopes jose.lopes at ist.utl.pt writes: unionWith :: Ord k = (a - b - c) - Map k a - Map k b - Map k c what should be the result of unionWith undefined (M.singleton False 42) (M.singleton True bar) ? Perhaps the generalized

Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-05-28 Thread Edward Kmett
Hi Dominic, The proposal is admittedly rather unfortunately opaque. The parts I can shed light on: Students come up with proposals with the help of the community and then submit them to google-melange.com. A bunch of folks from the haskell community sign up as potential mentors, vote on and

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Tom Ellis
On Tue, May 28, 2013 at 04:42:35PM +0200, Johannes Gerer wrote: By the same argument, could'nt I say, that any type class (call it AnyClass) can do everything a Monad can: instance AnyClass m = Monad (Cokleilsi m ()) That doesn't say that AnyClass can do anything a Monad can. AnyClass m =

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Johannes Gerer
That makes sense. But why does instance Monad m = ArrowApply (Kleisli m) show that a Monad can do anything an ArrowApply can (and the two are thus equivalent)? On Tue, May 28, 2013 at 5:17 PM, Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote: On Tue, May 28, 2013 at 04:42:35PM

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Tom Ellis
On Tue, May 28, 2013 at 05:21:58PM +0200, Johannes Gerer wrote: That makes sense. But why does instance Monad m = ArrowApply (Kleisli m) show that a Monad can do anything an ArrowApply can (and the two are thus equivalent)? I've tried to chase around the equivalence between these two

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Johannes Gerer
Ok, now I see a difference, why Kleisli can be used to relate typeclasses (like Monad and ArrowApply) and Cokleisli can not: Kleisli m () _ = () - m _ is isomorphic to m _ whereas Cokleisli m () _ = m _ - () is not. Can somebody point out the relevant category theoretical concepts, that are

[Haskell-cafe] Module import and use in GHC plugin?

2013-05-28 Thread Conal Elliott
In writing GHC plugins, how can I (a) add a module import (preferably qualified) and (b) make vars/ids for names imported from the newly imported module (to insert in the transformed Core code)? Thanks, - Conal ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread CJ van den Berg
On 2013-05-28 02:07, Manuel M T Chakravarty wrote: CJ van den Berg c...@vdbonline.com: I have successfully written Java/Haskell programs using the Java Native Interface. You can find my JNI to Haskell binding library at https://github.com/neurocyte/foreign-jni. I am primarily using it to

Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread CJ van den Berg
The RTS was ported to Android, yes. But not by me. I just wrote ghc-android, which is just a build script to help people with setting up the somewhat complex cross-compiler build. IIRC Nathan Hüsken did most of the porting work. Everything you need should be on github. ghc-android and

Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread CJ van den Berg
No, you can go both ways. You can call Haskell from Java and Java from Haskell. Write Android Apps in Haskell will of course be just the same as writing Android Apps in Java. That’s just the price you pay for having full API access. There is of course nothing preventing someone from creating more

Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-28 Thread Kristopher Micinski
Awesome! I was hoping that someone would do this, and I'd be really happy to see what could be done here. This is the big crutch of using Haskell on Android is obviously that the API sort of sucks for Haskell... Kris On Tue, May 28, 2013 at 2:01 PM, CJ van den Berg c...@vdbonline.com wrote:

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Johannes Gerer
What about these two very simple type classes. Are they equivalent? (As Monad and ArrowApply) (This actually compiles in GHC) class Pointed f where pure :: a - f a class Unit f where unit :: f a a newtype UnitPointed f a = UnitPointed f a a instance Unit f = Pointed (UnitPointed f) where

Re: [Haskell-cafe] Stream instance for Parsec + conduits

2013-05-28 Thread Roman Cheplyaka
Hi Phil, Sorry for the late answer — somehow I missed your email when it was originally posted. Parsec wasn't designed for incremental input, and adding it without modifying the internals would be tricky. The problem with your code is this: at the branching point, Parsec remembers the current

[Haskell-cafe] Design of extremely usable programming language libraries

2013-05-28 Thread Andrey Chudnov
Dear Cafe, I'm exploring the design space of programming language libraries with enhanced usability and I'd your help and comments. I'll start with a few short questions, but offer a detailed discussion of the motivations and the problems I'm facing below. So, if you have interest in the subject

Re: [Haskell-cafe] Design of extremely usable programming language libraries

2013-05-28 Thread Roman Cheplyaka
* Andrey Chudnov achud...@gmail.com [2013-05-28 16:36:14-0400] * Does any generic traversal/transformation (uniplate-style) library support GADTs? Any syb-style library works with GADTs, by the virtue of dealing with value representations instead of type representations. * What is the best

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Tom Ellis
On Tue, May 28, 2013 at 09:09:48PM +0200, Johannes Gerer wrote: What about these two very simple type classes. Are they equivalent? [...] class Pointed f where pure :: a - f a class Unit f where unit :: f a a newtype UnitPointed f a = UnitPointed f a a instance Unit f = Pointed

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Johannes Gerer
Dear Tom, I really appreciate your help, but If I could ask the perfect question I probably would already know the answer... My example should not prove anything, instead they collectively show, that I am missing something. And it is not the fact, that pure f does not depend on f. If, however,

Re: [Haskell-cafe] Design of extremely usable programming language libraries

2013-05-28 Thread Andrey Chudnov
Thanks for a prompt reply, Roman. On 05/28/2013 04:52 PM, Roman Cheplyaka wrote: Any syb-style library works with GADTs, by the virtue of dealing with value representations instead of type representations. I tried to use syb, but the following code fails to typecheck for me. What am I doing

Re: [Haskell-cafe] Type classes

2013-05-28 Thread Tom Ellis
On Tue, May 28, 2013 at 11:22:22PM +0200, Johannes Gerer wrote: I have to ask, why was plausability and looking at the actual definition (not just the types) not important for the other examples. It would also be important to check the definitions in the other examples too, but it's hard enough

Re: [Haskell-cafe] Design of extremely usable programming language libraries

2013-05-28 Thread John Lato
Not sure what you mean here — attoparsec does support unlimited lookahead, in the sense that a parser may fail arbitrarily late in the input stream, and backtrack to any previous state. Although attoparsec is a poor choice for programming language parsing, primarily because of the error

Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-05-28 Thread Ben Lippmeier
On 29/05/2013, at 1:11 AM, Edward Kmett wrote: This unfortunately means, that we can't really show the unaccepted proposals with information about how to avoid getting your proposal rejected. You can if you rewrite the key points of proposal to retain the overall message, but remove

Re: [Haskell-cafe] Hackage Update Brigade

2013-05-28 Thread Lyndon Maydwell
How can I join the group? P.S. I've attached a simple image for the Gravatar if it looks okay. On Tue, May 28, 2013 at 12:40 PM, Conrad Parker con...@metadecks.orgwrote: On 28 May 2013 05:29, Alexander Solla alex.so...@gmail.com wrote: As per recent discussions, I'm making a list of

Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-05-28 Thread Edward Kmett
The majority of the rejections are of precisely that form, or just were slightly out-competed by another similar proposal in their space. These items either are stated or should be stated in the student application guidelines, but a successful summer of code submission probably has most of the

Re: [Haskell-cafe] Hackage Update Brigade

2013-05-28 Thread Conrad Parker
On 29 May 2013 08:54, Lyndon Maydwell maydw...@gmail.com wrote: How can I join the group? by asking any of the current members :) I've added you. P.S. I've attached a simple image for the Gravatar if it looks okay. great, can you add it? Conrad. On Tue, May 28, 2013 at 12:40 PM, Conrad

Re: [Haskell-cafe] Hackage Update Brigade

2013-05-28 Thread Lyndon Maydwell
Done :) On Wed, May 29, 2013 at 12:22 PM, Conrad Parker con...@metadecks.orgwrote: On 29 May 2013 08:54, Lyndon Maydwell maydw...@gmail.com wrote: How can I join the group? by asking any of the current members :) I've added you. P.S. I've attached a simple image for the Gravatar if it

Re: [Haskell-cafe] Design of extremely usable programming language libraries

2013-05-28 Thread Roman Cheplyaka
Unfortunately you can only do traversals, not unfolds, with GADTs. That's because in an unfold, the return type is determined by the value itself and can vary among the produced results, whereas in a traversal it is determined by the input type. This means also that you cannot simply derive