Re: [Haskell-cafe] Haskell Logo Macbook Decal
I've heard good things about teespring. I gather it's like a kickstarter but specifically for t-shirts. They seem to have some procedures[1] in place specifically for non-profit organizations, which might be a good option for supporting haskell.org. [1]: http://teespring.com/solutions (confusingly, the page is titled enterprise solutions, but I think it's actually about non-profit organizations) Assuming the campaign isn't hard to set up, it's probably worth doing. I know I'd certainly buy a shirt. Or maybe a sweatshirt. A campaign like this might also make a good rally point for informing the community that haskell.org is now a registered non-profit :). On Tue, Oct 1, 2013 at 8:19 PM, Jason Dagit dag...@gmail.com wrote: On Tue, Oct 1, 2013 at 3:50 PM, Kyle Hanson hanoo...@gmail.com wrote: I ordered mine! Does anyone know if there is any place where I could order pre-made Haskell t-shirt that benefits haskell.org too? I don't know where, but I just wanted to say thank you to both you and Ryan and everyone else who buys one. Setting something up like this is great! And we definitely want to encourage it. So if you do find a place to order shirts (maybe cafepress?) please let us know. You might also like to know that haskell.org can now accept donations directly: http://www.haskell.org/haskellwiki/Donate_to_Haskell.org Gershom announced it at the recent Haskell Implementors Workshop and we're still working on getting the word out to a wider audience. In the future, haskell.org would like to use donations to buy dedicated development time for key bits of Haskell infrastructure. I think we'll have more to say about that in a week or two (work in progress). Thanks for your support! Jason ___ 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] Poll plea: State of GUI graphics libraries in Haskell
Could threepenny work with webGL, or is that too far out of the scope of the project? I guess the overhead of having a server--even locally--and using a web browser might just be too much for many use cases. On Sep 27, 2013 1:51 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Conal Elliott wrote: I'm polling to see whether there are will and expertise to reboot graphics and GUIs work in Haskell. I miss working on functional graphics and GUIs in Haskell, as I've been blocked for several years (eight?) due to the absence of low-level foundation libraries having the following properties: * cross-platform, * easily buildable, * GHCi-friendly, and * OpenGL-compatible. The last several times I tried Gtk2hs, I was unable to compile it on my Mac. Years ago when I was able to compile, the GUIs looked and interacted like a Linux app, which made them awkward and upleasant to use. wxHaskell (whose API and visual appearance I prefered) has for years been incompatible with GHCi, in that the second time I open a top-level window, the host process (GHCi) dies abruptly. Since my GUI graphics programs are often one-liners, and I tend to experiment a lot, using a full compilation greatly thwarts my flow. For many years, I've thought that the situation would eventually improve, since I'm far from the only person who wants GUIs or graphics from Haskell. About three years ago, I built a modern replacement of my old Pan and Vertigo systems (optimized high-level functional graphics in 2D and 3D), generating screamingly fast GPU rendering code. I'd love to share it with the community, but I'm unable to use it even myself. Two questions: * Am I mistaken about the current status? I.e., is there a solution for Haskell GUI graphics programming that satisfies the properties I'm looking for (cross-platform, easily buildable, GHCi-friendly, and OpenGL-compatible)? * Are there people willing and able to fix this situation? My own contributions would be to test and to share high-level composable and efficient GUI and graphics libraries on top of a working foundation. Hello Conal, I have been similarly dissatisfied with the state of GUI libraries in Haskell and have finally started working on one myself: [threepenny-gui][1]. Threepenny-gui uses the web browser as a display, which means that it's cross-platform, easy to install and works from GHCi! On the flip side, it doesn't support native OpenGL. [1]: http://www.haskell.org/**haskellwiki/Threepenny-guihttp://www.haskell.org/haskellwiki/Threepenny-gui Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] Proposal: New syntax for Haskell
My problem with cucumber is not the idea of a high-level DSL for tests. Au contraire--I think this is a perfect place for a little language. I could easily see a similar tool being useful for Haskell. Rather, my issue is with the syntax. Not gherkin in particular but rather languages that try to look like English in general. For one, these languages tend to hit the uncanny valley--they're somewhat natural, but not entirely. Perhaps the code reads like poorly written prose, but you certainly can't write it in a natural fashion! More importantly, I do not think prose is a good format for this sort of thing at all. It's good for reading code, but I almost never read code directly. Instead, I usually look over large parts of code at a time. I want code where I can get the structure at a glance and easily separate the parts that are specific to the current application from ones that aren't. With prose-like syntax, this is very difficult because everything is made of words. That programming language syntax you dismiss as line noise? It's actually the structure of the code, which makes it much *faster* to read! There's a reason mathematicians user equations and diagrams so much. A single equation can replace literally pages of text, and you can have a pretty good idea of what's going on without having to look too closely at all the details. Think about an integral, for example: from the equation, you can easily see what sort of equation it is (trigonometric, polynomial, exponential...), what domain you're integrating over, what the limits are and, very importantly, that it *is* an integral rather than something completely different. All just from what the equation looks like, before you've had to expend much attention on it. One way to think about it is that the notation factors out the repeated parts of an integral so that it's easy to visually separate from the meat--the function you're actually integrating. A good DSL uses symbols to do the same thing. The main cost, of course, is that you have to learn the notation. But this is really a one-time cost; if you're going to be seeing a lot of integrals, it's more than worth doing, especially because there's so much shared structure between them. Similarly, it's worth doing for tests, for the same reasons. There's a lot of shared structure--just look at how many relatively long phrases got repeated even in the simple examples given here--and you want to look over that structure without actually reading it. Much easier with actual syntax than prose. In any real app, you will have hundreds of tests, and learning to deal with the line noise gets amortized over all of them, whereas the benefits (shorter code that's easier to scan) scale at least linearly. So I think we should really avoid the faux-natural-language syntax as much as possible. I just want to chime in to defend Cucumber, which I use in Ruby at my day job. I see a lot of people put up the strawman that it can only be used as a way for business people to write acceptance tests. That idea is questionable and I've never worked at a company big enough to require that, or with business people who have ever wanted to write my tests for me. In Ruby, I use Cucumber purely for myself to drive high level acceptance tests for products. I think the sweet spot for it is when you're starting work on a high level feature and you have NO idea how it will be implemented or even how it will work in detail. I find that writing in the limited language that Gherkin provides keeps my brain from going right to implementation details. I write out tests that explore how the system should work. I write them in the perspective of the user (which you should be doing in your head regardless because the user is the one who will actually interact with your program). I then read them back and make sure they make logical sense. Only then do I start hooking up the steps I wrote to code that drives integration/acceptance tests, via a browser for instance. At the end I have a failing cucumber test that describes the system in an intuitive manner with zero line noise (programming language syntax). I am now free to think about implementation details, write lower level unit tests and implement things that can be described in much less verbose fashion. I really like that process and if I ever had a job to develop products in Haskell, I'd probably take a similar approach. Do note that I advocate using Cucumber to create/drive user stories, not to unit test low level functions like folds. If you don't have a customer of a particular function who could describe how they interact with it in layman's term, then Cucumber is the wrong tool. Use quickcheck/hunit/hspec for that. On Thu, Sep 12, 2013 at 3:42 PM, Bob Ippolito b...@redivi.com wrote: Have you tried AppleScript? I wouldn't say it's pleasant to use, but it's easy to read. On Thursday, September 12, 2013, David Thomas wrote: I've long been interested in a scripting language
Re: [Haskell-cafe] continuations and monads
Yes they are. Purely intuitively, you can see how writing code in a monadic style (using = a lot) is very similar to writing in continuation-passing style. You can express this the most directly with the continuation monad. Then, from this monad, you can express other monads. In some sense, the continuation monad is very fundamental. Take a look at The Mother of all Monads[1] from The Neighborhood of Infinity for more details. [1]: http://blog.sigfpe.com/2008/12/mother-of-all-monads.html?m=1 On Aug 17, 2013 7:02 PM, Christopher Howard christopher.how...@frigidcode.com wrote: Q: Are the continuations in Scheme related to the monads from Haskell? If so, could someone elaborate on that? __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] Alternative name for return
If we're adding applicative brackets, it would be nice to have something like ⦇⦈ as options via UnicodeSyntax. When playing around with She, I found it much easier to read than the ASCII version, especially when I needed to combine them: (|(|a + b|) + (|c * d|)|) ⦇⦇a + b⦈ + ⦇c * d⦈⦈ Coincidentally, She is the perfect way to experiment with idiom brackets while thinking about a patch like this. I found it very illustrative just to go through old code and see what could really be improved and what couldn't. For me personally, I certainly found *some* code became more readable, but not quite as much as I expected. On Thu, Aug 15, 2013 at 10:44 AM, Anton Nikishaev m...@lelf.lu wrote: Simon Peyton-Jones simo...@microsoft.com writes: | Indeed, I wished the 0-ary case would be more alike to the unary | and binary case, cf. | | return f0 | f1 $ a1 | f2 $ a1 * a2 | | What is needed is a nice syntax for idiom brackets. Indeed. I'm quite open to adding idiom brackets to GHC, if everyone can agree on their syntax, and someone would like to offer a patch. Something like (| f a1 a2 |) perhaps? I can make a patch after people agree on everything. There's also http://hackage.haskell.org/package/applicative-quoters with its template haskell nastiness h :m +Control.Applicative.QQ.Idiom h :set -XQuasiQuotes h [i| (,) THX BYE |] [('T','B'),('T','Y'),('T','E'),('H','B'),('H','Y'),('H','E'),('X','B'),('X','Y'),('X','E')] -- lelf ___ 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] ANNOUNCE: tasty, a new testing framework
Could you add some documentation on how to use this with cabal? I've found integrating tests with cabal unintuitive and poorly documented--to the point where I haven't really bothered! I've gotten it working before, but I would have to look it up again in the future. (I also didn't use a framework.) It would be awesome to see an example .cabal file along with your example test cases. thanks, -tikhon On Tue, Aug 6, 2013 at 1:53 AM, Roman Cheplyaka r...@ro-che.info wrote: * Carter Schonwald carter.schonw...@gmail.com [2013-08-05 16:58:37-0400] fair enough. I take it that you're also (implicitly) committing to maintaining this for the next few years? :) That's correct. Roman ___ 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] Sneaky method for var-arg fns?
Take a look at Text.Printf which takes this idea even further with its printf function, which can accept an arbitrary number of arguments. This is achieved by basically using your approach but with a recursive instance. On Jul 26, 2013 10:10 PM, Micah Cowan mi...@cowan.name wrote: So, just for fun, I came up with a way to abuse the language in order to define a function whose argument is optional: -- dirty-trick.hs - A sneaky way to do var args fns in Haskell {-# LANGUAGE FlexibleInstances #-} class Hello a where hello :: a instance Hello (String - String) where hello = (\str - Hello ++ str) instance Hello String where hello = hello World In ghci, putStrLn $ hello gives Hello World, while putStrLn $ hello There gives Hello. . I was wondering if there was a way to do it in pure Haskell (i.e., no GHC pragmas required), and also the specific reason for why the above example doesn't work without the pragma (I think it's just that in general a - b is not syntactically allowed for type specifiers within instance declarations)? I'm also interested in alternative approaches to creating variable-argument functions, if there are any. . If anyone's curious, this was prompted by a discussion with a friend (copied), about Haskell and Clojure. He mentioned that Clojure can accept variable arguments, though AFAICT all Clojure functions basically act like they take a list (that supports variable types), so accepting an empty argument list is a bit analogous to Haskell accepting an empty list, rather than no arguments. Part of the reason Haskell can't really take variable arguments is that all Haskell functions really just take one argument. But I figured you could use the contextually expected type to decide whether to return a simple value (not /technically/ a function in that case), or a function expecting further arguments, which could then be extended to define a function taking any arbitrary number of arguments. Cheers! -mjc ___ 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] newbie question about Functional dependencies conflict between instance declarations:.....
You're running into the open worldassumption--anybody could come along and make Integer part of your NotAnInteger class, and there's nothing you can do to stop them. This is a design tradeoff for typeclasses: typeclass instances are always global and are exported to all other modules you use. This means you cannot ensure a type is *not* part of a typeclass. (Or, at the very least, you can't convince GHC of this fact.) For more information about this, take a look at the following StackOverflow question: http://stackoverflow.com/questions/8728596/explicitly-import-instances On Jul 5, 2013 8:47 AM, Nicholls, Mark nicholls.m...@vimn.com wrote: Hello, ** ** I largely don’t know what I’m doing or even trying to do, it is a voyage into the unknown….but….if I go… ** ** {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} ** ** class Foo x y | x - y, y - x instance Foo Integer Integer ** ** That seems to work….and my head seems to say…your created some sort of binary relation between 2 types…and made Integer,Integer a member of it… ** ** Something like that anyway…. ** ** Then I go…. ** ** data Bar ** ** instance Foo Bar x ** ** Error!but I’m think I understand this….I can’t claim that Bar,x is a member of Foo and Integer,Integer is member of Foo and preserve my functional dependencies, because Bar,Integer is now a member of Foo..*** * ** ** Bad programmer……. ** ** ** ** So how I naively go…. ** ** ** ** class NotAnInteger a ** ** instance (NotAnInteger x) = Foo Bar x ** ** I haven’t declared integer to be “NotAnInteger”….so (in a closed world)….this would seem to exclude the contradiction….but… ** ** ** ** Functional dependencies conflict between instance declarations: instance Foo Integer Integer -- Defined at liam1.lhs:7:12 instance NotAnInteger x = Foo Bar x -- Defined at liam1.lhs:13:12** ** ** ** So **i)**I clearly don’t understand something about the type system. **ii) **I don’t know how to restrict type variables in instance declarations….i.e. how do I use the notion of “Foo” across different combinations of types, without them colliding. ** ** ** ** ** ** ** ** ** ** ** ** ** ** CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. ___ 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] question about indentation conventions
My current approach is not to have one rule for every case but rather to indent however seems best for the particular code. For example, for Parsec's |, I try to make the code look like a BNF grammar rather than adhering to normal indentation conventions. Perhaps as a carry-over from my C-style programming days, I usually have the operators at the end of the line, but I put | at the beginning, several steps *left* of where it would normally be, to get everything aligned nicely. Similarly, I try to align things to show the structure of the code. For example, if I have two similar function calls on top of each other, I try to highlight the parallelism: foo (Just $ a + b) Nothing foo Nothing (Just $ a + b) The main idea is that I try to format my code not based on what the *code* is but based on what it *means*. I don't know if this is entirely reasonable, but I like it. I've thought about writing an automatic indenting tool for Haskell (or, more accurately, a pretty-printer) for another project I have, and this is the main thing that threw me off. While automatic indentation might make sense for less expressive languages (Google Go being an extreme example), I think it would be too constraining for Haskell. After all, in reasonable code, chances are that similar constructs end up meaning wildly different things (especially with the advent of pervasive embedded DSLs), so the code itself is a poor indicator of its own structure. So this is really something of an aside, but I do not think that a gofmt-style tool would be quite as useful for Haskell, and it certainly does not replace good taste. ** On Mon, Jul 1, 2013 at 9:34 AM, Sturdy, Ian sturdy...@mail.wlu.edu wrote: I always preferred (I think going back to my lisp days) foo x y z indenting subsequent arguments to the same level as the first, but I have not convinced haskell-mode to do that for me. (The general rule here being that similar things should be at the same indent, which will always result in subexpressions being further indented, but is somewhat more specific.) The case I never quite know what to do with is a series of expressions connected with operators, e.g. foo | bar | baz Leaving operators at the beginning of lines (rather than trailing the previous line) seems preferable, but does one (where the layout rules apply) align the operator or the function? (the alternative being, if your mail client does not make a mess of it with a variable-width font) foo | bar | baz ~IRS From: haskell-cafe-boun...@haskell.org [haskell-cafe-boun...@haskell.org] on behalf of Richard Cobbe [co...@ccs.neu.edu] Sent: Monday, July 01, 2013 8:00 AM To: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] question about indentation conventions On Mon, Jul 01, 2013 at 05:18:39PM +1200, Richard A. O'Keefe wrote: It looked pretty explicit to me: The golden rule of indentation ... you will do fairly well if you just remember a single rule: Code which is part of some expression should be indented further in than the beginning of that expression (even if the expression is not the leftmost element of the line). This means for example that f (g x y z) is OK but f (g x y z) is not. Sure. So my first question boils down to which of the two alternatives below does the community prefer? (To be clear about the intended semantics: this is the application of the function f to the arguments x, y, and z.) f x y z or f x y z Both are correct, in most contexts. And then there's the second question: if the second alternative is preferable, is there a way to get haskell-mode to do it automatically? As it is, it refuses to indent y any farther to the right than in the first alternative. I can space it in by hand, and then haskell-mode puts z under y, but that's annoying, and it gets in the way of reindenting large regions of code automatically. Richard ___ 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] question about indentation conventions
That's certainly true. As I mentioned, I was actually considering a *pretty-printer* rather than an automatic indentation tool per se. The end results are similar, but the pretty-printer is really only the latter part of the problem: it's predicated on already having a valid AST. My particular use case involved diffing and merging ASTs directly; this means that I would have to somehow output the result in a human-readable format. Moreover, the actual AST I was outputting could have been the combination of two others, without any prior concrete syntax! I still haven't worked out a good way to do this for Haskell (or, to be fair, any other language). But yeah, Haskell is pretty intractable as far as language grammars go. I think this is a great compromise--I value language expressiveness over tooling--but it certainly is a compromise. On Mon, Jul 1, 2013 at 10:10 AM, Brandon Allbery allber...@gmail.comwrote: On Mon, Jul 1, 2013 at 9:56 AM, Tikhon Jelvis tik...@jelv.is wrote: I've thought about writing an automatic indenting tool for Haskell (or, more accurately, a pretty-printer) for another project I have, and this is the main thing that threw me off. While automatic indentation might make sense for less expressive languages (Google Go being an extreme example), I think it would be too constraining for Haskell. After all, in reasonable code, chances are that similar constructs end up meaning wildly different things (especially with the advent of pervasive embedded DSLs), so the code itself is a poor indicator of its own structure. One might look at the history of the indentation modules for Emacs haskell-mode. Short version: they gave up, tab iterates through the possibilities because it's quite impossible to know which one is correct without a *semantic*, not just syntactic, understanding of the code. (Which, when you think about it, is pretty much par for the Haskell language definition. See also the literally impossible brace insertion rule of Haskell98.) -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghci ghc - JS (Emscripten)
My understanding is that Try Haskell actually runs the submitted code on a server with mueval rather than compiling it to JavaScript and running it in the client. This is different from some of the other try websites (like try.ocamlpro.com), so it's easy to get confused. On Fri, Jun 28, 2013 at 11:24 AM, Henk-Jan van Tuyl hjgt...@chello.nlwrote: On Fri, 28 Jun 2013 15:25:59 +0200, B B blackbox.dev...@gmail.com wrote: Hi! Does anybody tried, or is there anywhere a project, of online ghc or ghci (compiled to JavaScript with Emscripten)? There is Try Haskell![0], source code can be found on GitHub[1] Regards, Henk-Jan van Tuyl [0] http://tryhaskell.org/ [1] https://github.com/chrisdone/**tryhaskellhttps://github.com/chrisdone/tryhaskell -- Folding@home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/**hjgtuyl/tourdemonad.htmlhttp://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] hand over maintenance of a package
As far as I know, Hackage does not enforce control of a given package at all. You can just have the new maintainer upload a new version of the package, changing the maintainer field of the .cabal file. On Jun 19, 2013 7:10 AM, Corentin Dupont corentin.dup...@gmail.com wrote: Hi Cafe, How to hand over the maintenance of a hackage package? Thanks Corentin ___ 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] Efficiency/Evaluation Question
There's a very good StackOverflow question which covers this: When is memoization automatic in GHC?[1]. I found it really cleared up the issue for me. [1]: http://stackoverflow.com/questions/3951012/when-is-memoization-automatic-in-ghc-haskell On Sat, Jun 15, 2013 at 9:13 PM, Clark Gaebel cgae...@uwaterloo.ca wrote: Yes. In general, GHC won't CSE for you. - Clark On Saturday, June 15, 2013, Christopher Howard wrote: On 06/15/2013 04:39 PM, Tommy Thorn wrote: There's not enough context to answer the specific question, but lazy evaluation isn't magic and the answer is probably no. Tommy Perhaps to simplify the question somewhat with a simpler example. Suppose you have code: let f x = if (x 4) then f 0 else (sin x + 2 * cos x) : f (x + 1) After calculating at x={0,1,2,3}, and the cycle repeats, are sin, cos, etc. calculated anymore? -- frigidcode.com ___ 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] Simplest way to learn FRP through use
Right. It's at https://github.com/TikhonJelvis/Reactive-Life. On May 31, 2013 11:46 PM, Christopher Howard christopher.how...@frigidcode.com wrote: On 05/31/2013 07:47 PM, Tikhon Jelvis wrote: My favorite mini app is John Conway's game of life. I implemented a version with reactive banana and found it perfect for learning the ideas. I have a simple version of the code up on GitHub if you ever want a nice example to read. I tried to make the code neat rather than worrying about performance or features. Would you be willing to give a URL for that? (To save posterity from the trouble of putting your name in a GitHub search box.) -- frigidcode.com ___ 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] Simplest way to learn FRP through use
My favorite mini app is John Conway's game of life. I implemented a version with reactive banana and found it perfect for learning the ideas. I have a simple version of the code up on GitHub if you ever want a nice example to read. I tried to make the code neat rather than worrying about performance or features. On May 31, 2013 8:43 PM, Christopher Howard christopher.how...@frigidcode.com wrote: I want to learn FRP but am having trouble wading through all the theory about how FRP is implemented and how it /could/ be used for various applications. What is the simplest, easiest-to-learn module or system allowing you to quickly make something interesting (if not very impressive) in an FRP style? Say, a simple simulation of some physical phenomena outputting its state to the terminal; or an object moving on the screen; or some other toy application that I could create and play with. -- frigidcode.com ___ 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] mapFst and mapSnd
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 exactly like your mapFst. On Tue, May 28, 2013 at 1: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) 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 prelude and Hoogle or Hayoo only turn up versions of them in packages like scion or fgl. Has anyone else felt the need for these functions? Am I missing some generalisation of them perhaps? Regards, Dominique ___ 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] List comprehensions with Word8
This happens because of how fromInteger is defined for Word8. It maps integers to integers mod 256. Also remember that 10 is actually fromInteger 10, in all of your examples. So your example is actually equivalent to [0..1 `mod` 256]. On May 16, 2013 2:19 PM, Jose A. Lopes jose.lo...@ist.utl.pt wrote: Hello everyone, I was playing with Word8 and list comprehensions and the following examples came up. I have to admit the behavior looks quite strange because it does not seem to be consistent. Can someone shed some light on reason behind some of these outputs? By the way, I have abbreviated some outputs with ellipsis ... [1..10] :: [Word8] [1,2,3,4,5,6,7,8,9,10] [1..100] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,100] [1..1000] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,232] [1..1] :: [Word8] [1,2,3,4,5,6,7,8,9,10,11,12,**13,14,15,16] [1..10] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,160] [1..100] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,64] [1..1000] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,128] [1..1] :: [Word8] [] [1..10] :: [Word8] [] Thank you, Jose -- José António Branquinho de Oliveira Lopes Instituto Superior Técnico Technical University of Lisbon __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] [extension]syntactic sugar for maps
I'm genuinely curious as to how you use maps. I've found I use them far less in Haskell than in any other language: I only use them in select circumstances. And most of those uses would not benefit from a mayo literal. I suspect that many of the uses of map literals are better replaced with something like a record. This has the advantage of being static and more type safe. However, this is only based on my own use cases, so it's hard to generalize. On Mar 27, 2013 12:32 PM, Răzvan Rotaru razvan.rot...@gmail.com wrote: Hi, I am terribly missing some syntactic sugar for maps (associative data structures) in Haskell. I find myself using them more than any other data structure, and I think there is no big deal in adding some sugar for this to the language. I could not find out whether such an extension is beeing discussed. If not, I would like to propose and extension. Any help and suggestions are very welcome here. Thanks. Also related to the topic: 1/ Is there a list of proposals for extensions to Haskell that has currently been accepted in the new standard? I have not found one on Haskell' ( http://hackage.haskell.org/trac/haskell-prime/query?status=newstatus=assignedstatus=reopenedgroup=state), but it looks outdated. No mentions to the new standard! 2/ I have seen somewhere a statement that a new language standard will be published yearly. Didn't happen until now. Is there even a new standard on the way? Cheers, Răzvan ___ 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] Is there a tool like ri from ruby?
Have you tried Hoogle? I know you can install it locally and use it from GHCi or Emacs. I'm not familiar with ri, but from your description I think a local Hoogle would serve the same purpose with the added benefit of being able to search by types. Here's the wiki page about it: http://www.haskell.org/haskellwiki/Hoogle On Fri, Nov 23, 2012 at 11:18 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: RI is a very easy using tool that search and show the documents of ruby modules/functions, etc. Using RI, I could get help when programming with a few commands. Quick and simple. And with RI backend (libs), I could also simply integrate ri to my IDE (like one hotkey to show function summary). So I am wondering if there is such thing in Haskell world. I know haddock saves the .haddock files in document folder. But I do not know if there is any existing tools to index and view them. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ 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