Re: [Haskell-cafe] who's in charge?
Also, this is a complete aside but what the heck. :-) Has anyone else been driven crazy by the way that Java code and libraries are documented? It seems like whenever I try to figure out how to use a piece of Java code, the functionality is spread out over a huge collection of classes and methods so that it is impossible to figure out where things actually happen and how the code is supposed to be used. Am I correct to perceive this as a general trend in Java, or is it just the projects that I looked at and/or my lack of experience in how Java sources and libraries are organize? Cheers, Greg On 10/28/10 9:53 PM, aditya siram wrote: I understand your frustration at not having free tested libs ready-to-go, Java/any-other-mainstream-language programmers tend to expect this and usually get it. If a lack of libs is a dealbreaker for you and you want to use a functional programming language with some of Haskell's advantages (like immutability, lazy data structures and STM) I encourage you to check out Clojure [1] a nicely designed Lisp. It is tightly integrated in to the JVM and you have access to all the Java libs you want. -deech [1] http://clojure.org/ 2010/10/27 Günther Schmidt gue.schm...@web.de mailto:gue.schm...@web.de Hi Malcolm, well if I would like to point out that, for instance, Haskell exists for a lot more than 10 years now, and that, while the language per se rocks, and there are cool tools (cabal) and libraries (list, Set, Map), there still isn't even a mail client library, I wonder whom to escalate this to, and who is going to do something about it. I understand some parties wish to avoid success at all costs, while others, commercial users, benefit from the edge haskell gives them already and which probably can help themselves in case of, again, for instance a missing mail client library. And then there is the ones like me, which also want to benefit from the edge Haskell gives them over users of other languages and want to develop Real World Apps and who cannot easily help themselves in case of a missing mail client library. So while there are many aspects of the future of haskell, who effectively is it that steers the boat? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org mailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] who's in charge?
On 29 October 2010 17:33, Gregory Crosswhite gcr...@phys.washington.edu wrote: Also, this is a complete aside but what the heck. :-) Has anyone else been driven crazy by the way that Java code and libraries are documented? It seems like whenever I try to figure out how to use a piece of Java code, the functionality is spread out over a huge collection of classes and methods so that it is impossible to figure out where things actually happen and how the code is supposed to be used. Am I correct to perceive this as a general trend in Java, or is it just the projects that I looked at and/or my lack of experience in how Java sources and libraries are organize? From my memories of using Java (of which I've been clean for about 18mths now, woohoo!!! :D) this was the case, because the different aspects of a container, etc. was abstracted away so much. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] libffi mystery
Hi Thanks for the help! I've made some progress, but I'm not there yet. On 28 Oct 2010, at 20:08, Ketil Malde wrote: Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com writes: Have you tried passing -optl-static to ghc (which causes -static to be passed to ld)? This was new to me. I gave it a whirl. I got lots of linker errors about missing pthread this, missing pthread that, so... It used to be: -optl-static -optl-pthread ...seemed like a good plan. I got lots of scary warnings like (.text+0x51d8): warning: Using 'setprotoent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/haskell-packages/ghc6/lib/network-2.2.1.7/ghc-6.12.1/ libHSnetwork-2.2.1.7.a(BSD.o): In function `suy9_info': (.text+0x12f6): warning: Using 'endprotoent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/haskell-packages/ghc6/lib/network-2.2.1.7/ghc-6.12.1/ libHSnetwork-2.2.1.7.a(BSD.o): In function `svAk_info': but an executable emerges. If I run the executable from the prompt, it dumps some html, but it still 500s on the web server. So there are at least options and ways to control what's going on. I haven't figured out how to achieve the 6.8.2-alike linking, but oughtn't it to be possible? Many thanks Conor ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskellers.com idea: strike forces
Hey all, In the recent discussion about the status of email support in Haskell, the idea of strike forces to tackle these big problems came up. I think one dilemma people face when trying to coordinate such a venture is the logistics: where to organize, how to advertise it, where to have discussions that can be publicly accessible. This may be something that the Haskellers website can help address. Here's an idea, please give me any feedback you have (especially the negative kind): * Anyone can create a strike force, by specifying a name for the strike force and giving a description. That person will automatically be the administrator for the strike force. * Anyone on Haskellers can watch a strike force; this will contribute to its popularity. The most popular strike forces will be shown at the top of the listings, to give an idea of what projects are active and which are dead. * People must apply to be members of a strike force, and be approved by a strike force admin. Strike force admins also have the right to add new admins/remove current admins. * Admins can add links to other websites, list Hackage packages that are part of this strike force's scope, etc. Ideas on this are welcome. * There will be some kind of discussion forum. The only thing I know for certain about this is we want to have a news feed to give updates on what's happening. I'm open to suggestions on what to implement here, but some ideas: ** A request/bug tracker. ** Free-form message boards. Possibly requires moderation for non-members. ** I'm not certain if it should just be a single thread, multi discussion threads, hierarchical discussions like Reddit, etc. Please let me know what you think. And if you think this is a foolish idea that won't help the community out, please let me know that too. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskellers.com idea: strike forces
On 29 October 2010 19:06, Michael Snoyman mich...@snoyman.com wrote: Hey all, In the recent discussion about the status of email support in Haskell, the idea of strike forces to tackle these big problems came up. I think one dilemma people face when trying to coordinate such a venture is the logistics: where to organize, how to advertise it, where to have discussions that can be publicly accessible. This may be something that the Haskellers website can help address. Here's an idea, please give me any feedback you have (especially the negative kind): * Anyone can create a strike force, by specifying a name for the strike force and giving a description. That person will automatically be the administrator for the strike force. * Anyone on Haskellers can watch a strike force; this will contribute to its popularity. The most popular strike forces will be shown at the top of the listings, to give an idea of what projects are active and which are dead. * People must apply to be members of a strike force, and be approved by a strike force admin. Strike force admins also have the right to add new admins/remove current admins. * Admins can add links to other websites, list Hackage packages that are part of this strike force's scope, etc. Ideas on this are welcome. * There will be some kind of discussion forum. The only thing I know for certain about this is we want to have a news feed to give updates on what's happening. I'm open to suggestions on what to implement here, but some ideas: ** A request/bug tracker. ** Free-form message boards. Possibly requires moderation for non-members. ** I'm not certain if it should just be a single thread, multi discussion threads, hierarchical discussions like Reddit, etc. Please let me know what you think. And if you think this is a foolish idea that won't help the community out, please let me know that too. I _really_ like this idea. With this nebulous proposal of yours, is there any way of maybe integrating the various services already hosted at haskell.org and its sub-domains (mailing lists, tracs, etc.) or are you looking at re-inventing the wheel? Rather than just strike-forces, this could become more Haskell Special Interest Groups; that way, if someone wants help with a particular area of Haskell (web development, graph theory, etc.) they can contact that SIG rather than -cafe in general. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] who's in charge?
2) If there is a problem, here's what you could do about it, in descending order of attractiveness: y) specify the requirements (a sample application of what needs to be supported would be a start) z) review the existing options wrt to those requirements (which ones are you aware about, why don't they work for you?) (*) a) Fix it yourself b) Pay someone else to fix it c) Motivate or politely encourage others to fix it, providing moral support, etc. d) provide framework organisation (repo, discussion venu, code outline, issue and task tracking, ..) so that others can contribute small patches instead of having to take on full responsibilities? (*) IMO, the lack of good quality reviews of hackage contributions (especially over whole usage areas, such as web development, GUIs, databases, ..) has been a major and growing obstacle to hackage use, not to mention targetting of efforts. Some form of wiki-based hackage reviews column (with editor-in-charge, invited reviews, and mild reviewing of reviews for obvious problems, but otherwise free-form and -schedule) would probably work, if integrated into hackage itself. Unfortunately, I don't have the time to edit such a thing, but perhaps others here feel motivated to do so? Claus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] who's in charge?
Hi aditya, thanks for the tip. No, I must admit a deal breaker it is not, giving all the advantages of haskell on the one hand I think I'd be able to life with something half baked. Günther Am 29.10.10 06:53, schrieb aditya siram: I understand your frustration at not having free tested libs ready-to-go, Java/any-other-mainstream-language programmers tend to expect this and usually get it. If a lack of libs is a dealbreaker for you and you want to use a functional programming language with some of Haskell's advantages (like immutability, lazy data structures and STM) I encourage you to check out Clojure [1] a nicely designed Lisp. It is tightly integrated in to the JVM and you have access to all the Java libs you want. -deech [1] http://clojure.org/ 2010/10/27 Günther Schmidtgue.schm...@web.de Hi Malcolm, well if I would like to point out that, for instance, Haskell exists for a lot more than 10 years now, and that, while the language per se rocks, and there are cool tools (cabal) and libraries (list, Set, Map), there still isn't even a mail client library, I wonder whom to escalate this to, and who is going to do something about it. I understand some parties wish to avoid success at all costs, while others, commercial users, benefit from the edge haskell gives them already and which probably can help themselves in case of, again, for instance a missing mail client library. And then there is the ones like me, which also want to benefit from the edge Haskell gives them over users of other languages and want to develop Real World Apps and who cannot easily help themselves in case of a missing mail client library. So while there are many aspects of the future of haskell, who effectively is it that steers the boat? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskellers.com idea: strike forces
On Fri, Oct 29, 2010 at 10:14 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 29 October 2010 19:06, Michael Snoyman mich...@snoyman.com wrote: [..] I _really_ like this idea. With this nebulous proposal of yours, is there any way of maybe integrating the various services already hosted at haskell.org and its sub-domains (mailing lists, tracs, etc.) or are you looking at re-inventing the wheel? Rather than just strike-forces, this could become more Haskell Special Interest Groups; that way, if someone wants help with a particular area of Haskell (web development, graph theory, etc.) they can contact that SIG rather than -cafe in general. Mental note: must remember to use word nebulous more often, I like it. Anyway, integration with existing services would be very good, but I doubt it will be possible. I don't think there's a way to automatically create a mailing list, trac project, and so on and so forth, and I'm not certain it would make sense to make such a feature possible. I suppose something like this would be a possible goal to look towards if we ever start working more seriously on single-signon and the like, but for now, I think we're stuck reinventing the wheel. Your SIG idea sounds possible, let's play it out. I'll go with web development, since I'm personally involved there. I suppose the idea would be I could create such an interest group, and hopefully developers on other frameworks (Happstack and Snap for instance) could join the team. Users may come and start requesting features, and everyone interested in solving the problem could participate in the discussion. Seems like it would fit right in with the strike force proposal, just under a different name. I have no objection to trying to name this something more generic such as SIG. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] libffi mystery
Conor McBride co...@strictlypositive.org writes: ...seemed like a good plan. I got lots of scary warnings like (.text+0x51d8): warning: Using 'setprotoent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking I guess the message is pretty self-explanatory, but current policy for libc these days is that static linking is deprecated, and that a statically linked libc just manually opens other libraries dynamically - at hard coded paths, too. One possible solution is to use an alternative libc, which ISTR asking for, but not getting any suggestions. but an executable emerges. If I run the executable from the prompt, it dumps some html, but it still 500s on the web server. As in 500 -Internal error? Did you check the logs? Usually there would be some output there. -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskellers.com idea: strike forces
On 29 October 2010 20:19, Michael Snoyman mich...@snoyman.com wrote: Mental note: must remember to use word nebulous more often, I like it. As do I ;-) Anyway, integration with existing services would be very good, but I doubt it will be possible. I don't think there's a way to automatically create a mailing list, trac project, and so on and so forth, and I'm not certain it would make sense to make such a feature possible. I suppose something like this would be a possible goal to look towards if we ever start working more seriously on single-signon and the like, but for now, I think we're stuck reinventing the wheel. At the very least, there could be a link to a pre-existing mailing list and trac instance. For those projects/strikeforces/SIGs that don't have existing bug trackers, which would you think of using? Are you suddenly going to write a new one in Haskell? :p Your SIG idea sounds possible, let's play it out. I'll go with web development, since I'm personally involved there. I suppose the idea would be I could create such an interest group, and hopefully developers on other frameworks (Happstack and Snap for instance) could join the team. Users may come and start requesting features, and everyone interested in solving the problem could participate in the discussion. Seems like it would fit right in with the strike force proposal, just under a different name. I have no objection to trying to name this something more generic such as SIG. Yeah, to me strike force sounds like a more temporary thing designed to get something done, and then dissolve once that library is written. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskellers.com idea: strike forces
On Fri, Oct 29, 2010 at 11:30 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 29 October 2010 20:19, Michael Snoyman mich...@snoyman.com wrote: Anyway, integration with existing services would be very good, but I doubt it will be possible. I don't think there's a way to automatically create a mailing list, trac project, and so on and so forth, and I'm not certain it would make sense to make such a feature possible. I suppose something like this would be a possible goal to look towards if we ever start working more seriously on single-signon and the like, but for now, I think we're stuck reinventing the wheel. At the very least, there could be a link to a pre-existing mailing list and trac instance. I think the SIG admin will be in charge of adding any links he/she wishes. Maybe we'll make the discussion/tracker stuff optional. For those projects/strikeforces/SIGs that don't have existing bug trackers, which would you think of using? Are you suddenly going to write a new one in Haskell? :p Umm apparently. I'm not really planning on anything complex, but this is the area where I really wanted community feedback. Here's an example proposal for how it would work: There's no separate tracker; instead, there is a discussion board only. Members of the SIG can create new topics and add messages to existing topics at will. Non-members must have these actions moderated by an admin. The topics will appear on the SIG page, and there will be a news feed to get notified of new topics/messages. Messages will be linear within a topic. This is just about the simplest proposal I can come up with. We could add statuses (open, assigned, resolved, irrelevant) to topics, or other things like that. Is this reimplementing trac in an inferior way? Yes. Will this make it easier for users to participate in multiple SIGs and follow lots of different topics simultaneously? I believe so. Your SIG idea sounds possible, let's play it out. I'll go with web development, since I'm personally involved there. I suppose the idea would be I could create such an interest group, and hopefully developers on other frameworks (Happstack and Snap for instance) could join the team. Users may come and start requesting features, and everyone interested in solving the problem could participate in the discussion. Seems like it would fit right in with the strike force proposal, just under a different name. I have no objection to trying to name this something more generic such as SIG. Yeah, to me strike force sounds like a more temporary thing designed to get something done, and then dissolve once that library is written. Sounds good. Which makes me think we should have a SIG status field, letting admins specify that their SIGs have been dissolved. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] type class design
Dear Haskellers, I've a question about type class design. When developing the set of functions for a class, there are often two or more functions, let's say f and g, where the semantics of g can be expressed by f. When writing down the code, there are two choices for g. First g is included in the type class, second g is defined outside and the signature has a context referencing the class. 1. case class Foo a where f :: ... a ... g :: ... a ... g = expr[f] 2. case class Foo a where f :: ... a ... g :: Foo a = ... a ... g = expr[f] What are the reasons for choosing 1., what are the arguments for 2.? My arguments for 1.: a) Efficiency: g may be overwritten in an instance declaration by a more efficient piece of code. b) Readability: All functions, which are logically connected are grouped together in a single syntactic construct and can be found in one place (similar to an interface in Java). My argument for 2.: c) Correctness: The semantics for g are fix (relative to f), All laws for g hold everywhere, assuming f is implemented correctly. I've sometimes the problem to balance the reasons for 1. and 2 and I doubt, that this list of criteria is complete. In the standard Haskell classes we can find both cases, even within a single class. Eq with (==) as f and (/=) as g belongs to the 1. case, so does Monad and (=) as f and () as g. But (=) and the Monad class fall into the 2. case. It seem, there is no uniform or consistent strategy in the core Haskell classes. What are your best practice rules for this problem? Expecting your advices, Uwe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] who's in charge?
On Fri, Oct 29, 2010 at 5:06 AM, Steve Severance st...@medwizard.net wrote: whenever I here any open source community (yeah...everyone not just haskell) tell beginners to contribute a package I always scratch my head with a little bit of wonder. Would you really want a package that someone like me who is still trying to figure out how to utilize haskell's features would build? Do you want my outrageous non-use of the Monads that haskell offers? Can I just take up this point and say, yes I do. It's much easier to fix a bad library than write a good one :P Besides, I'd think that often what Haskell developers lack is time more than skill - there are plenty of tasks that could be done without advanced knowledge of deep abstractions, if only someone could put aside a few weekends for them. For example, writing low-level FFI bindings is almost mechanical (i.e. requires basically no actual ingenuity) with the right tools, but it takes time and effort, so libraries go unbound. In short, you do not need a PhD to write a decent and useful library! Just open a github and give out commit access like confetti and everything will be fine :) I also think that it's a good idea to review Haskell packages more thoroughly, but I think shiny-new-hackage is going to help a little in that regard with reverse dependencies prominently visible on package pages. I also think that it should be convention to link every hackage package with a page on the wiki for discussion (perhaps creating a new namespace in mediawiki for this purpose). This would be as simple as adding an autogenerated link to hackage's template. This is not a new idea, but it's yet to be popularised, and I think it needs backing from Hackage itself to do that. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] type class design
Hi, Uwe Schmidt wrote: In the standard Haskell classes we can find both cases, even within a single class. Eq with (==) as f and (/=) as g belongs to the 1. case Note that the case of (==) and (/=) is slightly different, because not only can (/=) be defined in terms (==), but also the other way around. The default definitions of (==) and (/=) are mutually recursive, and trivially nonterminating. This leaves the choice to the instance writer to either implement (==) or (/=). Or, for performance reasons, both. Tillmann ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] type class design
On 29 October 2010 23:28, Uwe Schmidt u...@fh-wedel.de wrote: Dear Haskellers, I've a question about type class design. When developing the set of functions for a class, there are often two or more functions, let's say f and g, where the semantics of g can be expressed by f. When writing down the code, there are two choices for g. First g is included in the type class, second g is defined outside and the signature has a context referencing the class. 1. case class Foo a where f :: ... a ... g :: ... a ... g = expr[f] 2. case class Foo a where f :: ... a ... g :: Foo a = ... a ... g = expr[f] [snip] My argument for 2.: c) Correctness: The semantics for g are fix (relative to f), All laws for g hold everywhere, assuming f is implemented correctly. Another possible argument: large type classes can look daunting for both implementors and users, even if only one or two methods need to be defined for a minimal instantiation (I'm tring to work out what to do here myself, as I have some typeclasses that for efficiency reasons it might be nice to have more methods in the class, but it makes it a little overwhelming). -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Decoupling type classes (e.g. Applicative)?
Hi all, I have a problem with the design of the Applicative type class, and I'm interested to know people's opinion about this. Currently, the Functor and Applicative type class are defined like this: class Functor f where fmap:: (a - b) - f a - f b class Functor f = Applicative f where pure :: a - f a (*) :: f (a - b) - f a - f b My problem is that in the grammar-combinators library [1], the pure combinator is too general for me. I would propose a hierarchy like the following: class Pointed f where pure :: a - f a class ApplicativeC f where (*) :: f (a - b) - f a - f b The original type class Applicative can then be recovered as follows, and the applicative laws can be specified informally in this class's definition. class (Pointed f, ApplicativeC f, Functor f) = Applicative f where This would allow me to restrict injected values to stuff I can lift into Template Haskell later on: class LiftablyPointed f where pureL :: (Lift a) - a - f a pureL' :: a - Q Exp - f a class (LiftablyPointed f, ApplicativeC) = LiftablyApplicative f where This problem currently makes it impossible for me to use the (*) combinator and I have to redefine it under a different name (I currently use ()). To me the problem seems similar to the well known example of the inclusion of the fail primitive in the monad class, where the general opinion seems to be that it was a bad idea to include fail in the Monad class (see e.g. the article on the haskell wiki about handling failure [2]). I've been thinking about the following type class design principles: * Only include two functions in the same design class if both can be implemented in terms of each other. * Only introduce a dependency from type class A to type class B if all functions in type class B can be implemented in terms of the functions in type class A or if type class A is empty. (Disclaimer: I currently do not follow these principles myself ;)) I would like to know people's opinions about this. Are there any issues with this advice that I don't see? Have other people encountered similar problems? Any interesting references? Thanks, Dominique Footnotes: [1] http://projects.haskell.org/grammar-combinators/ [2] http://www.haskell.org/haskellwiki/Failure ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Red links in the new haskell theme
Thank's. I didn't see the menu style on top of the page. It helps a lot. I think it's just a matter of getting used with the new colors... []s Victor On Oct 28, 2010, at 11:51 PM, Antoine Latter wrote: On Thu, Oct 28, 2010 at 2:42 PM, Andrew Coppin andrewcop...@btinternet.com wrote: On 28/10/2010 12:30 PM, Sebastian Fischer wrote: Maybe we can keep at least the docs without red links. Pick the Classic style in the style menu. It will remember your choice. Yes, at least with new Haddock you can *change* the style without having to actually patch (and recompile) Haddock itself. :-) In the category of annoying things: Is there any particular *reason* why Source appears before Contents? I would think the latter is going to get clicked infinitely more often than the former... Well, I can almost always use the back button to go to 'Contents,' however I don't have any other options for getting to source. I guess I use them about equally when I'm browsing Hackage. Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] State nested structures
Hello the list, I have another silly question. In my software I have a very common pattern: --in file A.hs module A where data A = A {b :: B, i :: Int} type SA x = State A x -- many functions with SA x --in file B.hs data B = B {r :: Int} type SB x = State B x -- many functions with SB x Of course in module A I'm calling some functions of module B. I'd like to know if it's possible, in a function of type SA, to call a function of type SB, without actually executing the State SB. I just wanna tell him Hey look, you can construct a SA from a SB like this! For now I have this: bToA:: (B - B) - A - A bToA bb = (λa - a{b = bb (b a)}) useB :: SB () - SA () useB = modify . bToA . execState Can I get rid of the execState? Also, I can't manage to write the more generic function SB x - SA x. Cheers, Corentin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decoupling type classes (e.g. Applicative)?
On 29 October 2010 14:35, Dominique Devriese dominique.devri...@cs.kuleuven.be wrote: I have a problem with the design of the Applicative type class Sorry for going a bit off-topic, but every-time I see someone complaining about such things, I remember this proposal: http://repetae.net/recent/out/classalias.html Just wanted to say, wouldn't it be nice? :) Best, Ozgur ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] State nested structures
2010/10/29 Dupont Corentin corentin.dup...@gmail.com: Of course in module A I'm calling some functions of module B. I'd like to know if it's possible, in a function of type SA, to call a function of type SB, without actually executing the State SB. I just wanna tell him Hey look, you can construct a SA from a SB like this! Also, I can't manage to write the more generic function SB x - SA x. You can have a class that expresses the operations upon some B, e.g. class MonadB m where getB :: m b and then implement that class for both SA and SB. Or you can implement MonadTrans in order to write the more generic function SB x - SA x. Possibly both but preferably the former imho. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Current thinking on CompositionAsDot issue in haskell prime?
Speaking of MagicHash, is it really necessary to take an operator with potential like (#) just to keep primitive symbols separate from the rest? At least from my 2010 Haskell learner perspective, it seems odd to create a whole language extension/lexical change just for that purpose. On Thu, Oct 28, 2010 at 10:20 PM, wren ng thornton w...@freegeek.orgwrote: On 10/28/10 10:42 AM, Ben Millwood wrote: Here's the wiki page: http://hackage.haskell.org/trac/haskell-prime/wiki/CompositionAsDot Personally I think function composition is what Haskell is all about and it is absolutely essential that the syntax for it be lightweight. If we think using . as qualification as well as composition is confusing, I'm much more inclined to say using it as qualification was a mistake. The comment on the wiki page about $ being more common in reality is not even close to true for my own code, and I don't think I'm unusual in that regard. Agreed on both counts. Personally, I'd much rather have name qualification and record selection use a different character than to remove (.) as composition. And replacing (.) with some abomination like `o` is unthinkable. As for the selector character, I'm partial to # but that would clash with MagicHash. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?
I've been thinking about the following type class design principles: * Only include two functions in the same design class if both can be implemented in terms of each other. * Only introduce a dependency from type class A to type class B if all functions in type class B can be implemented in terms of the functions in type class A or if type class A is empty. One of the other well-known type class inconveniences is the Num type class. The major inconvenience is that abs and signum are in the same type class as (+), (*), fromInteger etc, since within mathematics there are many structures on which the latter can be defined but not the former. The minor inconvenience is that (+) and (*) are in the same type class, since on occasion one wants an instance which defines one but not the other. I would also say that the Eq, Show constraints on Num are unwarranted. So to get to the point, I guess I would say that another design principle (perhaps a looser version of your first) is - don't put things together in a type class if they can be understood as separate concepts Unfortunately it is very hard, if not impossible, to get existing type classes changed, due to the amount of code that now depends on them. I have been thinking for a while that it might be worth defining a Prelude2, which corrects the known problems with the Prelude. Over time, people could migrate to using Prelude2. It would probably take years to be widely adopted, but at least there would be light at the end of the tunnel. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] State nested structures
2010/10/29 Dupont Corentin corentin.dup...@gmail.com: Also, I can't manage to write the more generic function SB x - SA x. Horribly enough this one seems to work... mapOnBofA :: SB a - SA a mapOnBofA mf = get = \st@(A {b=temp}) - let (ans,temp2) = runState mf temp in put (st { b=temp2}) return ans However, I'd have to question why you want both SA and SB as state functional types. Having inner runState's is sometimes good practice (its an instance of the Local Effect pattern identified by Ralf Laemmel and Joost Visser), but if you have it commonly I'd suspect you design is somehow contrived and could be simplified. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] type class design
On Fri, Oct 29, 2010 at 1:33 PM, Tillmann Rendel ren...@informatik.uni-marburg.de wrote: Note that the case of (==) and (/=) is slightly different, because not only can (/=) be defined in terms (==), but also the other way around. The default definitions of (==) and (/=) are mutually recursive, and trivially nonterminating. This leaves the choice to the instance writer to either implement (==) or (/=). Or, for performance reasons, both. I find these sorts of defaults deeply unsatisfying: particularly, suppose I do newtype Foo = Foo Integer deriving (Eq, Show) instance Num Foo where Foo a + Foo b = Foo (a + b) fromInteger = Foo expr = Foo 3 - Foo 2 That I haven't defined implementations for (-) or negate will not even get me a compiler warning, let alone a static error: it will just stack overflow or spin endlessly on expr. This kind of bug is notoriously difficult to track down. I'm not sure how to handle this better, though. A compiler that automatically calculated minimal complete definitions would be nice, but relatively complicated. It might be more sensible to just take all efficiency methods out of classes, and use a mechanism like rewrite rules to give an efficient implementation where possible. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: State nested structures
Horribly enough this one seems to work... mapOnBofA :: SB a - SA a mapOnBofA mf = get = \st@(A {b=temp}) - let (ans,temp2) = runState mf temp in put (st { b=temp2}) return ans There is nothing horrible about that. You just run a new isolated computation in the State Monad for B and use its results. More or less see same solution as Dupont's. @Dupont: telling from your possible use case and your last post with your MAP- Problem, these two are very similar. You have a monad and inside your monad you temporarily want to run some computation in another Monad. I think Monad-Transformers are maybe the better option for you (especially your interpreter-Problem was a good use case for StateT/ ErrorT instead of State and some Either inside it...). On 29 Okt., 17:35, Stephen Tetley stephen.tet...@gmail.com wrote: 2010/10/29 Dupont Corentin corentin.dup...@gmail.com: Also, I can't manage to write the more generic function SB x - SA x. However, I'd have to question why you want both SA and SB as state functional types. Having inner runState's is sometimes good practice (its an instance of the Local Effect pattern identified by Ralf Laemmel and Joost Visser), but if you have it commonly I'd suspect you design is somehow contrived and could be simplified. ___ Haskell-Cafe mailing list haskell-c...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?
I have been thinking for a while that it might be worth defining a Prelude2, which corrects the known problems with the Prelude. Over time, people could migrate to using Prelude2. It would probably take years to be widely adopted, but at least there would be light at the end of the tunnel. There are some (at least one) libraries that try to do that, for example: http://hackage.haskell.org/package/numeric-prelude Sönke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: State nested structures
Thank you for your responses. I will look at monad transformers. I already use them I think because actually I use something like StateT Game IO a. You mean I have to implement my own instance? Oh, can you call me Corentin? This is my name ;) Cheers, Corentin On Fri, Oct 29, 2010 at 6:19 PM, steffen steffen.sier...@googlemail.comwrote: Horribly enough this one seems to work... mapOnBofA :: SB a - SA a mapOnBofA mf = get = \st@(A {b=temp}) - let (ans,temp2) = runState mf temp in put (st { b=temp2}) return ans There is nothing horrible about that. You just run a new isolated computation in the State Monad for B and use its results. More or less see same solution as Dupont's. @Dupont: telling from your possible use case and your last post with your MAP- Problem, these two are very similar. You have a monad and inside your monad you temporarily want to run some computation in another Monad. I think Monad-Transformers are maybe the better option for you (especially your interpreter-Problem was a good use case for StateT/ ErrorT instead of State and some Either inside it...). On 29 Okt., 17:35, Stephen Tetley stephen.tet...@gmail.com wrote: 2010/10/29 Dupont Corentin corentin.dup...@gmail.com: Also, I can't manage to write the more generic function SB x - SA x. However, I'd have to question why you want both SA and SB as state functional types. Having inner runState's is sometimes good practice (its an instance of the Local Effect pattern identified by Ralf Laemmel and Joost Visser), but if you have it commonly I'd suspect you design is somehow contrived and could be simplified. ___ Haskell-Cafe mailing list haskell-c...@haskell.orghttp:// www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: State nested structures
Nothing hinders you writing: StateT Game (StateT A IO) or GameT mt = ErrorT Err (StateT Game (mt IO)) with mt being another Monad-Transformer Monad-Transformers can be quite tricky. The point is you don't have to create new Monad instances. On 29 Okt., 18:46, Dupont Corentin corentin.dup...@gmail.com wrote: Thank you for your responses. I will look at monad transformers. I already use them I think because actually I use something like StateT Game IO a. You mean I have to implement my own instance? Oh, can you call me Corentin? This is my name ;) Cheers, Corentin On Fri, Oct 29, 2010 at 6:19 PM, steffen steffen.sier...@googlemail.comwrote: Horribly enough this one seems to work... mapOnBofA :: SB a - SA a mapOnBofA mf = get = \st@(A {b=temp}) - let (ans,temp2) = runState mf temp in put (st { b=temp2}) return ans There is nothing horrible about that. You just run a new isolated computation in the State Monad for B and use its results. More or less see same solution as Dupont's. @Dupont: telling from your possible use case and your last post with your MAP- Problem, these two are very similar. You have a monad and inside your monad you temporarily want to run some computation in another Monad. I think Monad-Transformers are maybe the better option for you (especially your interpreter-Problem was a good use case for StateT/ ErrorT instead of State and some Either inside it...). On 29 Okt., 17:35, Stephen Tetley stephen.tet...@gmail.com wrote: 2010/10/29 Dupont Corentin corentin.dup...@gmail.com: Also, I can't manage to write the more generic function SB x - SA x. However, I'd have to question why you want both SA and SB as state functional types. Having inner runState's is sometimes good practice (its an instance of the Local Effect pattern identified by Ralf Laemmel and Joost Visser), but if you have it commonly I'd suspect you design is somehow contrived and could be simplified. ___ Haskell-Cafe mailing list haskell-c...@haskell.orghttp:// www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list haskell-c...@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list haskell-c...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] who's in charge?
On Fri, Oct 29, 2010 at 8:31 AM, Ben Millwood hask...@benmachine.co.uk wrote: Besides, I'd think that often what Haskell developers lack is time more than skill - there are plenty of tasks that could be done without advanced knowledge of deep abstractions, if only someone could put aside a few weekends for them. For example, writing low-level FFI bindings is almost mechanical (i.e. requires basically no actual ingenuity) with the right tools, but it takes time and effort, so libraries go unbound. It's more than just that; when talking about libraries for some specific task, what matters most is actually the language-agnostic knowledge of the task itself. Particularly in the case of IO-oriented libraries with lots of FFI bindings, someone who knows the underlying C library (or what-have-you) inside and out is probably going to get the best results from writing a library, even with little knowledge of Haskell. - C. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Edit Hackage
On Thu, Oct 28, 2010 at 9:13 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: IIUC, [one of] the prime motivating factor[s] behind both reddit and StackOverflow is the accumulation of karma, which leads to people posting just to try and accumulate karma even if they don't know what they're talking about. Here, we are (hopefully) above such mundane things. Er, I suppose I should defend Stack Overflow a bit here. Yes, it has the whole reputation score thing, but actually does a pretty good job using it to motivate good activity without encouraging the sort of endless inane karma-pandering that tends to show up eventually on more general discussion-oriented sites. Usually the worst thing that happens--at least on the [haskell] tag--is quick-draw answers shooting from the hip and misreading the question slightly. Furthermore, Stack Overflow isn't really a place to track for information. It's a special-purpose site for programming-related QA. You either go there to ask for help with a problem, or you keep an eye out for new questions in order to answer them. It's not a discussion site and the vast majority of -cafe would be horrendously off-topic there (the question starting this thread, for instance, is only tangentially programming-related and probably wouldn't really belong). Also, the questions tend to be simple, beginner-level stuff for the most part, not ones that are likely to interest Haskell veterans (in fact, more advanced questions are liable to go unanswered, other than Simon or Don fielding an occasional question regarding gritty practical details about GHC). So essentially, participating on SO isn't really about the Haskell community as-is; it's about helping people learn Haskell and (by extension) promoting the language and hopefully bringing new people in. And for that purpose, SO's structure and design really do make it a better medium than the alternatives. But I wouldn't fault anyone for not bothering with it, if they're not interested in spending lots of time helping beginners out with the only reward being a slightly larger number on their account profile page. Another point against reddit: Don posted a link to my survey on the naming of fgl a few months back. Someone then queried [1] the two naming choices that were available on reddit rather than reading the discussions that had already taken place here on -cafe or bothering to actually ask _me_. Similar things go with submitted blog posts: rather than discussing the content as comments on the blog post, they discuss them on reddit thus depriving readers of the post itself of what they think. Speaking of not wanting more places to keep track of, that's precisely why I rarely bother with blog comments and would find discussions on reddit preferable: it's a single place to go, and keeps things more unified and consistent than whatever comment system some random blog has (most of which are more awkward to use than reddit, as well). Of course, having separate discussions going on in each is probably the worst of both worlds. Overall, I expect Don has a better feel than anyone else for where the Haskell community as a whole goes; if he says the balance is shifting away from -cafe I'd take that first as a statement of fact, not advocacy. I'd also venture to guess that, from the standpoint of a newcomer, reddit, Stack Overflow, and the like are the most visible parts of the Haskell community by a good margin, which means that as the community continues to grow any bias in favor of such places will likely do the same. So it goes... - C. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] fundata1 -- Karmic Social Capital Benchmark and Shootout
In the lessons you say: Haskell proved too slow with String Map, so we ended up interning strings and working with an IntMap and a dictionary to disintern back to strings as a last step. Daniel Fisher was instrumental in bringing Haskell up to speed with OCaml and then beating it. Don Stewart provided awesome leadership and amazing modification of Haskell's core data structured before your very eyes. Can you elaborate on this? and What do you mean by: modification of Haskell's core data structured ? Daryoush On Thu, Oct 28, 2010 at 5:53 PM, Alexy Khrabrov alexy.khrab...@gmail.comwrote: I am happy to announce fundata1 -- the largest-ever program per RAM allocation in Haskell, originally implemented in Clojure and then OCaml and Haskell for social network modeling. http://github.com/alexy/fundata1 It has now become the first large-scale social networking benchmark with a real dynamic social graph built from the actual Twitter gardenhose, with the data OK'd by Twitter and supplied along with the benchmark. I wrote three reference implementations, all on github as well. Clojure and OCaml are quite basic, while Haskell community had a chance to optimize its data structures and in fact fix a GC integer overflow while working on it. You're welcome to fork and improve all of these implementations, and supply others! There's a Google Group, http://groups.google.com/group/fundata/ to discuss the shootout. There's also a blog about it and other functional things at http://functional.tv/ Let the fun begin! -- Alexy Khrabrov firstname.lastnameATgmaildotcom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Daryoush Weblog: http://perlustration.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler
On 27 October 2010 13:30, Martijn Schrage mart...@oblomov.com wrote: On 21-10-10 01:01, Victor Nazarov wrote: This example creates a text field that turns red if it contains any non-digit characters. It is on-line at http://tryout.oblomov.com/ghcjs/ghcjs.html (Note: I only tested it on Firefox on a Mac) All used files are in a zip file at http://tryout.oblomov.com/ghcjs/ghcjs.zip (validate is in Test.hs, the JS monad in JS.hs, and the JavaScript for execHaskell in util.js) What browser are you using, IE8, IE9, FF and Chrome on Windows throw up errors, both locally and to your above code. Aaron ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] fundata1 -- Karmic Social Capital Benchmark and Shootout
dmehrtash: In the lessons you say: Haskell proved too slow with String Map, so we ended up interning strings and working with an IntMap and a dictionary to disintern back to strings as a last step. Daniel Fisher was instrumental in bringing Haskell up to speed with OCaml and then beating it. Don Stewart provided awesome leadership and amazing modification of Haskell's core data structured before your very eyes. Can you elaborate on this? and What do you mean by: modification of Haskell's core data structured ? I think he means some of the stuff Daniel and I did with specializing data structures (like IntMap) to their monomorphic key / elem types. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] type class design
On Fri, Oct 29, 2010 at 8:33 AM, Tillmann Rendel ren...@informatik.uni-marburg.de wrote: Hi, Uwe Schmidt wrote: In the standard Haskell classes we can find both cases, even within a single class. Eq with (==) as f and (/=) as g belongs to the 1. case Note that the case of (==) and (/=) is slightly different, because not only can (/=) be defined in terms (==), but also the other way around. The default definitions of (==) and (/=) are mutually recursive, and trivially nonterminating. This leaves the choice to the instance writer to either implement (==) or (/=). Or, for performance reasons, both. While I understand the argument in general, I've never understood why it applies to Eq. Are there any types where it is preferable to define (/=) instead of (==)? -- Dave Menendez d...@zednenem.com http://www.eyrie.org/~zednenem/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: State nested structures
you can find a nice introduction on using monad transformers by developing an interpreter at [1] and a little more detailed one at [2] [1]http://www.grabmueller.de/martin/www/pub/Transformers.pdf [2]http://www.haskell.org/all_about_monads/html/ On 29 Okt., 18:46, Dupont Corentin corentin.dup...@gmail.com wrote: Thank you for your responses. I will look at monad transformers. I already use them I think because actually I use something like StateT Game IO a. You mean I have to implement my own instance? Oh, can you call me Corentin? This is my name ;) Cheers, Corentin On Fri, Oct 29, 2010 at 6:19 PM, steffen steffen.sier...@googlemail.comwrote: Horribly enough this one seems to work... mapOnBofA :: SB a - SA a mapOnBofA mf = get = \st@(A {b=temp}) - let (ans,temp2) = runState mf temp in put (st { b=temp2}) return ans There is nothing horrible about that. You just run a new isolated computation in the State Monad for B and use its results. More or less see same solution as Dupont's. @Dupont: telling from your possible use case and your last post with your MAP- Problem, these two are very similar. You have a monad and inside your monad you temporarily want to run some computation in another Monad. I think Monad-Transformers are maybe the better option for you (especially your interpreter-Problem was a good use case for StateT/ ErrorT instead of State and some Either inside it...). On 29 Okt., 17:35, Stephen Tetley stephen.tet...@gmail.com wrote: 2010/10/29 Dupont Corentin corentin.dup...@gmail.com: Also, I can't manage to write the more generic function SB x - SA x. However, I'd have to question why you want both SA and SB as state functional types. Having inner runState's is sometimes good practice (its an instance of the Local Effect pattern identified by Ralf Laemmel and Joost Visser), but if you have it commonly I'd suspect you design is somehow contrived and could be simplified. ___ Haskell-Cafe mailing list haskell-c...@haskell.orghttp:// www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list haskell-c...@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list haskell-c...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Edit Hackage
On 30 October 2010 05:51, C. McCann c...@uptoisomorphism.net wrote: Speaking of not wanting more places to keep track of, that's precisely why I rarely bother with blog comments and would find discussions on reddit preferable: it's a single place to go, and keeps things more unified and consistent than whatever comment system some random blog has (most of which are more awkward to use than reddit, as well). Of course, having separate discussions going on in each is probably the worst of both worlds. So you'd prefer to have the discussion about a blog post be made distinct from the blog post itself? Why not keep them together, also so that people finding the blog post from someplace other than reddit (e.g. planet.haskell.org) can find them? Overall, I expect Don has a better feel than anyone else for where the Haskell community as a whole goes; if he says the balance is shifting away from -cafe I'd take that first as a statement of fact, not advocacy. I'd also venture to guess that, from the standpoint of a newcomer, reddit, Stack Overflow, and the like are the most visible parts of the Haskell community by a good margin, which means that as the community continues to grow any bias in favor of such places will likely do the same. So it goes... Neither the Haskell reddit nor Stack Overflow are linked to from haskell.org and there is nothing to indicate that they are official. Also, wasn't it Don that started (and is mainly responsible) for linking to Haskell articles on reddit? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)
On Fri, 22 Oct 2010, Sigbjorn Finne wrote: On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com wrote: libraries@, what's the right way to proceed? Can I make a Debian-style non-maintainer upload with minimal changes to fix urgent issues like these? I'd be much obliged if you could, and I do apologise for leaving all of this just hanging. I've just done this. Thanks for the blessing. 4000.0.10 should fix the reported issue with fail and Either, and bumps the base dep to build with GHC 7.0 No time available for Haskell projects these days unfortunately, Opera engine development taking up most of my waking hours. Getting someone to take over HTTP would be best, or maybe rewrite it altogether..it is not the prettiest thing around :) I'm not particularly keen on taking over maintainership, but I guess if noone else wants it I could take it over and do at least minimal updates like this. Any other volunteers? Cheers, Ganesh ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Edit Hackage
ivan.miljenovic: Neither the Haskell reddit nor Stack Overflow are linked to from haskell.org and there is nothing to indicate that they are official. Also, wasn't it Don that started (and is mainly responsible) for linking to Haskell articles on reddit? They're linked from the front page. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Edit Hackage
On 30 October 2010 09:51, Don Stewart d...@galois.com wrote: ivan.miljenovic: Neither the Haskell reddit nor Stack Overflow are linked to from haskell.org and there is nothing to indicate that they are official. Also, wasn't it Don that started (and is mainly responsible) for linking to Haskell articles on reddit? They're linked from the front page. Huh, so they are; shows how long it has been since I looked at the front page. We just need to get haskellers.com listed there now... -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Edit Hackage
ivan.miljenovic: On 30 October 2010 09:51, Don Stewart d...@galois.com wrote: ivan.miljenovic: Neither the Haskell reddit nor Stack Overflow are linked to from haskell.org and there is nothing to indicate that they are official. Also, wasn't it Don that started (and is mainly responsible) for linking to Haskell articles on reddit? They're linked from the front page. Huh, so they are; shows how long it has been since I looked at the front page. We just need to get haskellers.com listed there now... I added them in about Nov 2008, FWIW. http://haskell.org/haskellwiki/?title=Template:Main/Communityoldid=24203 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] who's in charge?
On 10/29/10 2:33 AM, Gregory Crosswhite wrote: Also, this is a complete aside but what the heck. :-) Has anyone else been driven crazy by the way that Java code and libraries are documented? It seems like whenever I try to figure out how to use a piece of Java code, the functionality is spread out over a huge collection of classes and methods so that it is impossible to figure out where things actually happen and how the code is supposed to be used. Am I correct to perceive this as a general trend in Java, or is it just the projects that I looked at and/or my lack of experience in how Java sources and libraries are organize? I've certainly noticed that, though JavaDoc does (usually) give links so you can follow the bread crumbs. Honestly, I think a big part of this isn't documentation practices so much as it is the expression problem. For a lot of the problems I tackle, the OO model is not appropriate for capturing program structure. Pairing this with Java's requirement of one class per file means that the actual functionality itself is spread out across a huge collection of classes and methods. The JavaDoc is just working with what it gets. This is one of the (many) reasons I prefer Haskell: the structure of Haskell programs matches the structure of the problems I need to solve (or at least, how I think about them). -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Edit Hackage
On Fri, Oct 29, 2010 at 6:13 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: So you'd prefer to have the discussion about a blog post be made distinct from the blog post itself? Why not keep them together, also so that people finding the blog post from someplace other than reddit (e.g. planet.haskell.org) can find them? Well, I'd most prefer that absolutely everything I'm interested in be conveniently kept together in one place, of course, but that's not really practical. Failing that, yes, I think reddit (or something like it) makes a better medium for discussion of broad topics than does the comment system on most blogs. Given a shared subject matter, e.g. Haskell, having one place with discussions about relevant posts from multiple blogs provides a richer overall context than does any one individual post. Anyway, lots of blogs these days have little submit/discuss this post on four-hundred-and-thirteen different web 2.0 social news sites!! buttons after every post, so it's not exactly hard to find them... Neither the Haskell reddit nor Stack Overflow are linked to from haskell.org and there is nothing to indicate that they are official. I skimmed the last couple months of archives for beginn...@haskell.org, found some straightforward questions, and for each one put a few keywords into a google search. About half the time there was a relevant question on Stack Overflow in the first page of results, at least once actually showing up ahead of the mail message I was searching based off of. The idea of community is a rather fluid and consensus-based sort of thing. At some point, visibility is the same thing as being official. (And yes, they are actually linked from haskell.org, but I'm not sure how much that's really worth.) Also, wasn't it Don that started (and is mainly responsible) for linking to Haskell articles on reddit? Maybe. Is there anything related to publicising Haskell that Don *hasn't* done? :) And I think he's only mainly responsible insofar as he tends to find and submit the good links first. - C. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Current thinking on CompositionAsDot issue in haskell prime?
On 10/29/10 11:18 AM, Daniel Peebles wrote: Speaking of MagicHash, is it really necessary to take an operator with potential like (#) just to keep primitive symbols separate from the rest? At least from my 2010 Haskell learner perspective, it seems odd to create a whole language extension/lexical change just for that purpose. I'm sort of torn on this issue. On the one hand (#) has great potential as an operator, on the other hand I've found that having something like -XMagicHash (or TeX's \makeatletter and \makeatother) can be really helpful when you want to expose some guts but also want to keep folks from using them accidentally. For example, I use a lot of newtypes to enforce various well-formedness constraints (a la weak-sigma types in dependently typed languages). Thus, I'll often define things like netwype Foo = Foo# Bar and then have a smart constructor (toFoo :: Bar - Maybe Foo) which verifies whatever invariant. Sometimes we may be forced to export Foo# in case other modules need to look inside in order to create new class instances or the like, but we don't want people using it in general since that'd violate the semantics of the type Foo. And Foo# is much nicer to type than UnsafeFoo[1]. Since it uses the MagicHash syntax, we can ensure that noone will use it blithely since they must first enable an extension to eliminate the syntax error. So you can make some nice lemonade from those lemons, but I'm not sure whether the lemonade is really worth eliminating every other citrus fruit (most of which are quite tasty). [1] In addition to toFoo, I'll often export a smart constructor (unsafeToFoo :: Bar - Foo) which will still test the invariants but throws an error instead of returning Nothing. The primary use of unsafeToFoo is to get consistent error messages when someone's going to be throwing the Maybe away anyways. Conversely, allowing them to use Foo# gives the same type as unsafeToFoo, but allows circumventing the invariant checking as a performance optimization. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] who's in charge?
Honestly, I think a big part of this isn't documentation practices so much as it is the expression problem. For a lot of the problems I tackle, the OO model is not appropriate for capturing program structure. Pairing this with Java's requirement of one class per file means that the actual functionality itself is spread out across a huge collection of classes and methods. The JavaDoc is just working with what it gets. This is one of the (many) reasons I prefer Haskell: the structure of Haskell programs matches the structure of the problems I need to solve (or at least, how I think about them). I've also noticed this, and I agree with the above. I track down some random type and it's just a one method interface, so you can embed the getter in some random object. In another language, you would just pass a function. Track down another and it's an enumeration, to be passed to a factory, to generate subclasses of some abstract superclass. In another language it would just be an ADT (the enumeration means the java can't add new subtypes anyway) and a function to operate on it in probably 1+n lines, but in java we're looking at 1+1+n+1 files, each with their overhead and directories, and of course their own names, so you have to track down each one, and remember what each name means as you try to understand the actual logic. In the specific example above, it was just reinventing Data.Monoid, so in haskell you wouldn't have to remember any new names, provided you already know 'mempty' and 'mappend'. Also the java style OO insistence that functions go with the data rather than with their related functions can require you to scatter the implementation of one logical function far and wide... ostensibly a feature I suppose, but can also be a liability. Et cetera. Sometimes I think it's just me, that I don't think in an OO way, but then again, the examples above were written by someone else who has done OO all his life. For me it really is the explosion of names that leads to overload. When writing haskell, I hardly ever finding myself wanting or reinventing subtyping, so for me at least, the haskell half of the expression problem is the practical half. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Current thinking on CompositionAsDot issue in haskell prime?
On Fri, Oct 29, 2010 at 7:54 PM, wren ng thornton w...@freegeek.org wrote: I'm sort of torn on this issue. On the one hand (#) has great potential as an operator, on the other hand I've found that having something like -XMagicHash (or TeX's \makeatletter and \makeatother) can be really helpful when you want to expose some guts but also want to keep folks from using them accidentally. Haskell officially supports unicode in identifiers, right? Why not pick some obscure and little-used symbol and leave the ones that are conveniently placed on standard keyboards for normal use? I suggest U+2621. - C. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Current thinking on CompositionAsDot issue in haskell prime?
On Thu, Oct 28, 2010 at 4:42 PM, Ben Millwood hask...@benmachine.co.uk wrote: Personally I think function composition is what Haskell is all about and it is absolutely essential that the syntax for it be lightweight. If we think using . as qualification as well as composition is confusing, I'm much more inclined to say using it as qualification was a mistake. Agreed. However for function composition I often use ∘ from: http://hackage.haskell.org/packages/archive/base-unicode-symbols/0.2.1.1/doc/html/Data-Function-Unicode.html Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Edit Hackage
On Thu, Oct 28, 2010 at 01:55:12PM -0700, Don Stewart wrote: The number of subscribers to the Haskell Reddit, for example, is double the -cafe@, and there are comparable numbers of questions being asked on the Stack Overflow [haskell] tag, as here -- so anyone who only reads -cafe@ is already missing a lot of stuff. A lot of the community has already voted on the efficacy of mailing lists for large communities, by moving their discussion elsewhere. Do you mean that people have actually unsubscribed from the list in favor of only following web-based media? New people who only join the web forums do not vote since they may not even know about the mailing list. I know that this is a hopeless battle, but since I feel very strongly about this, I'll indulge in defending the mailing list even though this is rather off-topic. The reasons why I prefer mailing lists (and newsgroups, rest in piece) over web-based discussion forums: * Usability: mail and news clients provide a consistent interface to all the discussions, and the customizability and diversity of clients ensures that everyone can access the discussions the way they like it. In contrast, web forums come with their built-in interfaces, and if you don't like them, you are SOL. * Scalability: related to the above, since mail and news provide a consistent interface to all the discussions, adding new lists and groups to be followed requires minimal effort since they just show up as new items whose updates get tracked automatically. In the worst case, adding a new web forum to be followed requires visiting the site frequently to check whether new messages have arrived. RSS and similar syndication technologies help, thankfully, but support for them is inconsistent, and often incomplete (they might not notify about new comments, only new topics). I subscribe to tens of mailing lists without problems. I wouldn't want to try to follow tens of web forums regularly. * Archivability: with mail and news, it is trivial for me to get local copies of the discussions (and the messages I myself have written) which I can peruse and search to my heart's content later without being dependent on the continued functioning of some external service. Although it is possible to save web pages locally, this usually very inconvenient, especially if one wants the local copies to be kept up to date with ongoing discussions. * Offline support: related to the above, with mail and news fetching and sending messages are separate from reading and writing them. Hence one can read and write messages even when one is for some reason not online. Web forums practically require an online connection when one wants to read the discussions. * Neutrality: newsgroups are completely distributed and not controlled by any single entity. Mailing lists are a centralized service, but a purely technical one. The haskell.org mailing lists (like the rest of haskell.org) are directly maintained by the community. In contrast, external web forums like reddit and stackoverflow are owned by companies, and visits to the sites bring ad revenue to the companies. Moreover, the contents of these sites are subject to deletion (or perhaps even editing) by the whims of their owners. In short, the old technologies of mail and news are technically vastly superior to web forums, which have required additional technologies (e.g. RSS) to attempt to overcome the obstacles that mail and news solve directly. It is true that web forums are nowadays very popular and have some nice features that the older technologies don't. The main reason for this, I suspect, is money: mail and news are from the older, more innocent age when internet technology was driven by the desire to communicate efficiently instead of making money. They are by their nature so neutral that they provide no financial incentive to develop them or support them. The web, on the other hand, provides many opportunites to profit by offering services, so it is no wonder that web technologies have flourished in the commercialized internet. Perhaps this is inevitable, and it is certainly ok for the haskell.org front page to provide links to reddit and stackoverflow just to inform visitors that these sites might be of interest. But by saying I encourage people to use the online forums: Haskell Reddit and Stack Overflow you are effectively saying: please let Condé Nast Digital and Stack Overflow Internet Services, Inc capitalize on your interest in and knowledge of Haskell. I most strongly object to this becoming the standard policy of the Haskell community. Cheers, Lauri ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Edit Hackage
On 30 October 2010 12:22, Lauri Alanko l...@iki.fi wrote: On Thu, Oct 28, 2010 at 01:55:12PM -0700, Don Stewart wrote: The number of subscribers to the Haskell Reddit, for example, is double the -cafe@, and there are comparable numbers of questions being asked on the Stack Overflow [haskell] tag, as here -- so anyone who only reads -cafe@ is already missing a lot of stuff. A lot of the community has already voted on the efficacy of mailing lists for large communities, by moving their discussion elsewhere. Do you mean that people have actually unsubscribed from the list in favor of only following web-based media? New people who only join the web forums do not vote since they may not even know about the mailing list. I know that this is a hopeless battle, but since I feel very strongly about this, I'll indulge in defending the mailing list even though this is rather off-topic. The reasons why I prefer mailing lists (and newsgroups, rest in piece) over web-based discussion forums: * Usability: mail and news clients provide a consistent interface to all the discussions, and the customizability and diversity of clients ensures that everyone can access the discussions the way they like it. In contrast, web forums come with their built-in interfaces, and if you don't like them, you are SOL. * Scalability: related to the above, since mail and news provide a consistent interface to all the discussions, adding new lists and groups to be followed requires minimal effort since they just show up as new items whose updates get tracked automatically. In the worst case, adding a new web forum to be followed requires visiting the site frequently to check whether new messages have arrived. RSS and similar syndication technologies help, thankfully, but support for them is inconsistent, and often incomplete (they might not notify about new comments, only new topics). I subscribe to tens of mailing lists without problems. I wouldn't want to try to follow tens of web forums regularly. * Archivability: with mail and news, it is trivial for me to get local copies of the discussions (and the messages I myself have written) which I can peruse and search to my heart's content later without being dependent on the continued functioning of some external service. Although it is possible to save web pages locally, this usually very inconvenient, especially if one wants the local copies to be kept up to date with ongoing discussions. * Offline support: related to the above, with mail and news fetching and sending messages are separate from reading and writing them. Hence one can read and write messages even when one is for some reason not online. Web forums practically require an online connection when one wants to read the discussions. * Neutrality: newsgroups are completely distributed and not controlled by any single entity. Mailing lists are a centralized service, but a purely technical one. The haskell.org mailing lists (like the rest of haskell.org) are directly maintained by the community. In contrast, external web forums like reddit and stackoverflow are owned by companies, and visits to the sites bring ad revenue to the companies. Moreover, the contents of these sites are subject to deletion (or perhaps even editing) by the whims of their owners. In short, the old technologies of mail and news are technically vastly superior to web forums, which have required additional technologies (e.g. RSS) to attempt to overcome the obstacles that mail and news solve directly. It is true that web forums are nowadays very popular and have some nice features that the older technologies don't. The main reason for this, I suspect, is money: mail and news are from the older, more innocent age when internet technology was driven by the desire to communicate efficiently instead of making money. They are by their nature so neutral that they provide no financial incentive to develop them or support them. The web, on the other hand, provides many opportunites to profit by offering services, so it is no wonder that web technologies have flourished in the commercialized internet. Perhaps this is inevitable, and it is certainly ok for the haskell.org front page to provide links to reddit and stackoverflow just to inform visitors that these sites might be of interest. But by saying I encourage people to use the online forums: Haskell Reddit and Stack Overflow you are effectively saying: please let Condé Nast Digital and Stack Overflow Internet Services, Inc capitalize on your interest in and knowledge of Haskell. I most strongly object to this becoming the standard policy of the Haskell community. +1; that's pretty much my opinion/arguments as well. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org
Re: [Haskell-cafe] Re: Current thinking on CompositionAsDot issue in haskell prime?
On 10/29/10 8:33 PM, C. McCann wrote: On Fri, Oct 29, 2010 at 7:54 PM, wren ng thorntonw...@freegeek.org wrote: I'm sort of torn on this issue. On the one hand (#) has great potential as an operator, on the other hand I've found that having something like -XMagicHash (or TeX's \makeatletter and \makeatother) can be really helpful when you want to expose some guts but also want to keep folks from using them accidentally. Haskell officially supports unicode in identifiers, right? Why not pick some obscure and little-used symbol and leave the ones that are conveniently placed on standard keyboards for normal use? That's doable, and no less portable than -XMagicHash already is. I suggest U+2621. I'm not sure I'd've ever recognized a funny 'z' as caution sign... :) -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Current thinking on CompositionAsDot issue in haskell prime?
On Fri, Oct 29, 2010 at 10:30 PM, wren ng thornton w...@freegeek.org wrote: I suggest U+2621. I'm not sure I'd've ever recognized a funny 'z' as caution sign... :) Well, I'm operating under the assumption that it's one of these: http://en.wikipedia.org/wiki/Bourbaki_dangerous_bend_symbol I would not be at all surprised at people working on Unicode being familiar with Knuth's use of the symbol. - C. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Monads and Functions sequence and sequence_
Hi, Can somebody please explain exactly how the monad functions sequence and sequence_ are meant to work? I have almost every Haskell textbook, but there's surprisingly little information in them about the two functions. From what I can gather, sequence and sequence_ behave differently depending on the types of the Monads that they are processing. Is this correct? Some concrete examples would be really helpful. Even references to some research papers that explain the rationale behind these (and all the other..?) monad functions would be great. Thanks in advance, Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Monads and Functions sequence and sequence_
On 2010-10-30 07:07, Mark Spezzano wrote: Hi, Can somebody please explain exactly how the monad functions sequence and sequence_ are meant to work? I have almost every Haskell textbook, but there's surprisingly little information in them about the two functions. From what I can gather, sequence and sequence_ behave differently depending on the types of the Monads that they are processing. Is this correct? Some concrete examples would be really helpful. sequence [m1,m2,m3,m4,...] = do x1 - m1 x2 - m2 x3 - m3 x4 - m4 ... return [x1,x2,x3,x4,...] sequence_ [m1,m2,m3,m4,...] = do m1 m2 m3 m4 ... return () Cheers, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monads and Functions sequence and sequence_
The expression sequence [a,b,c,...] is roughly equivalent to do r_a - a r_b - b r_c - c ... return [r_a,r_b,r_c,...] The expression sequence_ [a,b,c,...] is roughly equivalent to do a b c ... return () Does that help? Cheers, Greg On 10/29/10 10:07 PM, Mark Spezzano wrote: Hi, Can somebody please explain exactly how the monad functions sequence and sequence_ are meant to work? I have almost every Haskell textbook, but there's surprisingly little information in them about the two functions. From what I can gather, sequence and sequence_ behave differently depending on the types of the Monads that they are processing. Is this correct? Some concrete examples would be really helpful. Even references to some research papers that explain the rationale behind these (and all the other..?) monad functions would be great. Thanks in advance, Mark Spezzano ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Monads and Functions sequence and sequence_
Not exactly. If you use the type with Maybe Int like so: sequence [Just 1, Nothing, Just 2] then the result is Nothing. Whereas sequence [Just 1, Just 2, Just 3] gives Just [1, 2, 3] Why? I assume there's special implementations of sequence and sequence_ depending on the type of monad used. If it's a sequence_ [putStrLn hello, putStrLn goodbye] then this prints out hello and goodbye on separate lines. It seems to work differently for different types. Mark On 30/10/2010, at 3:42 PM, Bardur Arantsson wrote: On 2010-10-30 07:07, Mark Spezzano wrote: Hi, Can somebody please explain exactly how the monad functions sequence and sequence_ are meant to work? I have almost every Haskell textbook, but there's surprisingly little information in them about the two functions. From what I can gather, sequence and sequence_ behave differently depending on the types of the Monads that they are processing. Is this correct? Some concrete examples would be really helpful. sequence [m1,m2,m3,m4,...] = do x1 - m1 x2 - m2 x3 - m3 x4 - m4 ... return [x1,x2,x3,x4,...] sequence_ [m1,m2,m3,m4,...] = do m1 m2 m3 m4 ... return () Cheers, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Monads and Functions sequence and sequence_
On 30 October 2010 16:30, Mark Spezzano mark.spezz...@chariot.net.au wrote: Not exactly. If you use the type with Maybe Int like so: sequence [Just 1, Nothing, Just 2] then the result is Nothing. Whereas sequence [Just 1, Just 2, Just 3] gives Just [1, 2, 3] Why? I assume there's special implementations of sequence and sequence_ depending on the type of monad used. If it's a sequence_ [putStrLn hello, putStrLn goodbye] then this prints out hello and goodbye on separate lines. It seems to work differently for different types. The definition of the monad. In the Maybe monad, as soon as you get a Nothing the entire thing returns Nothing. sequence [ma,mb,mc] = do { a - ma; b - mb; c - mc; return [a,b,c] } = ma = \ a - mb = \ b - mc = \ c - return [a,b,c] However, for Maybe: instance Monad Maybe where ... Nothing = f = Nothing Just x = f = f x ... So yes, the behaviour of the Monad is dependent upon the Monad. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Monads and Functions sequence and sequence_
That is a result of the implementation of the specific Monad instance, and that does depend on the type, as you say (but it isn't determined for sequence(_) specifically). Nothing = f = Nothing Just x = f = f x is why a Nothing pollutes the sequenced lists of Maybes. If Maybe is a Monad representing computations that can fail (to produce a result), then if you sequence a bunch of such computations together, if any one computation fails, your entire computation fails. This reflects the natural behavior of the Maybe monad, where if you use x - maybe computation, the only way to produce that x is if the computation returned Just. In other monads, sequence will behave in the right way for that monad. On Sat, Oct 30, 2010 at 1:30 AM, Mark Spezzano mark.spezz...@chariot.net.au wrote: Not exactly. If you use the type with Maybe Int like so: sequence [Just 1, Nothing, Just 2] then the result is Nothing. Whereas sequence [Just 1, Just 2, Just 3] gives Just [1, 2, 3] Why? I assume there's special implementations of sequence and sequence_ depending on the type of monad used. If it's a sequence_ [putStrLn hello, putStrLn goodbye] then this prints out hello and goodbye on separate lines. It seems to work differently for different types. Mark On 30/10/2010, at 3:42 PM, Bardur Arantsson wrote: On 2010-10-30 07:07, Mark Spezzano wrote: Hi, Can somebody please explain exactly how the monad functions sequence and sequence_ are meant to work? I have almost every Haskell textbook, but there's surprisingly little information in them about the two functions. From what I can gather, sequence and sequence_ behave differently depending on the types of the Monads that they are processing. Is this correct? Some concrete examples would be really helpful. sequence [m1,m2,m3,m4,...] = do x1 - m1 x2 - m2 x3 - m3 x4 - m4 ... return [x1,x2,x3,x4,...] sequence_ [m1,m2,m3,m4,...] = do m1 m2 m3 m4 ... return () Cheers, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Monads and Functions sequence and sequence_
On Oct 30, 2010, at 2:30 PM, Mark Spezzano wrote: If you use the type with Maybe Int like so: sequence [Just 1, Nothing, Just 2] then the result is Nothing. Whereas sequence [Just 1, Just 2, Just 3] gives Just [1, 2, 3] Try do x - Just 1 y - Nothing z - Just 2 return [x,y,z] and do x - Just 1 y - Just 2 z - Just 3 return [x,y,z] The results are the same as with your calls of `sequence`. It is = which makes the difference, not `sequence`. Sebastian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe