Re: [Haskell-cafe] Haskell Platform and Leksah on Windows
On 9 Aug 2013, at 06:43, Vagif Verdi vagif.ve...@gmail.com wrote: Leksah is a linux program intented to run on linux. No, it is also intended to run on OS X and Windows. You can (in some cases) successfully install and run it on windows, but you would need to go through certain steps installing some unrelated to windows software (gtk etc) No, there are no steps needed to install Gtk to run Leksah (the DLLs are included in the Leksah installer). You really only need to install the Haskell Platform and Leksah. If you want the grep feature to work you will need grep in your PATH. I would recommend leksah maintainers to change the language on their website to prevent future problems like this. We have prebuilt Windows installers that bundle everything you need to run Leksah. http://www.leksah.org/download.html If your GHC compiler is not listed there you can try out one of the development releases (0.13.2.4 is current). This version includes Gtk3 and some WebKit based features. https://groups.google.com/forum/#!topic/leksah/7A4gr8iem5c While it is true that it is currently hard to install Gtk for dev purposes on Windows, it is easy to install Leksah. Hamish ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] deriving Data.HashTable - stack overflow
Ah, thanks, folks! I'll just implement my own hashing by generating a string and calling the hash function on that. That's what I was doing in the old version of my code, anyway. It's just that in the core Data.HashTable, you had to provide a hash function, so the point where I used the hash table was able to call a string conversion function that was defined elsewhere. With the hashtable package, you have to define a Hashable instance in the same package as your datatype definition - which is not where the string conversion is implemented. Calling the string conversion function leads to a cyclic dependency that I wanted to avoid. So I'll have to maybe move it to live with the datatype definition, or duplicate it, or use some other means of hashing. In other words, package A defines datatype A. Package B defines A - String. Package C creates a HashTable that indexes by As, and also imports package B, so it can build a hash function as the composition of the string conversion and the provided string hashing. But now I need to define the Hashable instance in A, which doesn't have access to package B, since package B also depends on A, and I don't like circular dependencies. - Lyle ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Platform and Leksah on Windows
On 9 Aug 2013, at 07:58, Gregory Weber gdwe...@iue.edu wrote: GTK and its (non-Haskell) dependencies seem to be the tricky part. I found the instructions for installing Gtk2hs on Windows http://www.haskell.org/haskellwiki/Gtk2Hs/Installation#Windows a bit sketchy, so wrote a blog post with more detailed instructions: http://spottedmetal.blogspot.com/2013/07/setting-up-haskell-gtk-development.html I normally work with Linux; Windows experts could probably make some improvements in my procedures. To install Gtk 3 on Windows I installed a Fedora VM and set it up to cross compile windows Gtk 3 apps. This is actually much easier than installing on Gtk 3 on windows. Fedora and OpenSUSE have mingw32 rpms for all your windows needs. They even include stuff like WebKit. I then shared the DLLs and header files with my Windows machine and installed Gtk2Hs using those. If you would rather not go to the trouble of installing a VM, then there is a python script in this article might help (I have not tried it)... http://stackoverflow.com/questions/6006689/where-can-i-download-precompiled-gtk-3-binaries-or-windows-installer Next time I have to refresh my Windows build machine I will try to document the process. Hamish ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] deriving Data.HashTable - stack overflow
I chose not to introduce another dependency. I just implemented the hash function by delegating to the Show instance of the nested type: data ValType = FloatType | IntType | StringType deriving (Show,Eq) data VarName = VarName ValType String deriving (Show,Eq) instance Hashable VarName where hash (VarName t n) = hash (show t ++ n) Not super-efficient, but it'll be fine. The printString function (defined in that other package) uses a single character prefix for each ValType. - Lyle ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] deriving Data.HashTable - stack overflow
Here's another way to do it: data ValType = FloatType | IntType | StringType deriving (Show,Eq) instance Hashable ValType where hash FloatType = 0 hash IntType = 1 hash StringType = 2 data VarName = VarName ValType String deriving (Show,Eq) instance Hashable VarName where hash (VarName t n) = hash (t, n) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installling Leksah on ghc7.6.3 with haskell-platform 2013?
You will need Leksah 0.13 for GHC 7.6.3 and it is not in Hackage yet. It is almost ready though. If run git clone https://github.com/leksah/leksah.git cd leksah cabal install cabal-meta cabal-src cabal-meta install It would be interesting to know if it works for you. On 20 Jun 2013, at 13:41, Carlo Hamalainen ca...@carlo-hamalainen.net wrote: Hi, I'm trying to install Leksah from hackage on my Debian testing laptop, which has ghc 7.6.3 and the Haskell Platform 2013. I fixed a bunch of errors about catch not being exported from the Prelude, but now I'm stuck on these two errors in leksah-server-0.8.0.5: [10 of 13] Compiling IDE.Utils.GHCUtils ( src/IDE/Utils/GHCUtils.hs, dist/build/IDE/Utils/GHCUtils.o ) src/IDE/Utils/GHCUtils.hs:94:40-62: Not in scope: data constructor `Opt_ReadUserPackageConf' src/IDE/Utils/GHCUtils.hs:161:44-50: Not in scope: data constructor `Opt_Cpp' Perhaps you meant one of these: `Opt_CSE' (imported from GHC), `Opt_Pp' (imported from GHC) Where have Opt_ReadUserPackageConf and Opt_Cpp gone in ghc 7.6.3? Cheers, -- Carlo ___ 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] Haskell Platform and Leksah on Windows
Hi, If you go the EclipseFP approach, you may have installations troubles too. In my case, it was due to having a version of GHC and libraries that EclipseFP doesn't like. Once I got it to work, I loved it. David. 2013/8/8 Dorin Lazar dorin.la...@gmail.com: Hi, I understood what's wrong about my approach - and since I want to use an IDE to assist me, I will try both EclipseFP and Sublime Text, to see how that works. My feeling was that since the leksah website suggested that cabal is the way to do it and since when I search for a Haskell IDE that is it, then it was obvious that the recommended way doesn't work as it should. In my mind the platform was broken, I understand now that it's not the platform, just this special way of using it. I was also in awe of the fact that nobody really says anything about these difficulties, and felt like an estranged child that messed things up badly; however, it seems that the real issue is that nobody really does it that way, and I was wrong to actually try it like that. As I said (or haven't, but will) once I will get the hang of it I will recount my experience for others to follow, hopefully in better terms than this frustrating first experience. Many thanks for everyone's advice on the list, Dorin On Thu, Aug 8, 2013 at 9:48 PM, Carter Schonwald carter.schonw...@gmail.com wrote: Hey Dorin, I don't understand your claims. 1) haskell has worked perfectly well on windows for quite some time. I used HUGs nearly a decade ago, and in more recent time (2-3 years ago) I helped teach an introductory first computer science class using GHC where many students were doing great work using notepad++ and ghci. I don't understand your focus on emacs and make files. 2) if you want an IDE experience, Sublime Text with the right plugins, or perhaps EclipseFP are worth checking out. 3) likewise, if you're finding tooling on windows unsatisfactory, help fix it! Bug reports, patches, or new tools and libraries are always welcome. Haskell is a relatively small community, and thusly limited manpower (we're all volunteers), so way to fix any problem is help out! cheers On Thu, Aug 8, 2013 at 3:30 AM, Dorin Lazar dorin.la...@gmail.com wrote: Hello, I am the original author of the post, and I finally received the emails from the mailman (probably there was an issue with the automated requests). My answers are inlined. 1) Leksah should not be considered an official haskell ide, but merely one of many community supported editing tools. And frankly one of the less widely used ones at that! Leksah is not used much at all by anyone, though theres probably a handful of folks who do use it. Many folks use editors like Sublime Tex (2/3), Emacs, Vi(m), textmate, and many more. Its worth noting that the sublime-haskell plugin for sublime text, and analogous packages for many other editors, provide haskell IDE-like powers, or at least a nice subset thereof. Unfortunately, I think the problem with this is that we have a different vision on how development should be done. I have extensive experience of working from console, with a simple text editor and hand-made Makefiles or anything similar. However, an IDE should be a productivity tool, that can help you improve your understanding of the language, and can assist you in following the proper syntax for a new language. While learning by doing 'write, save, compile, examine error message' is ok with me, it is slow, and it limits the time I can dedicate to learning the language itself. A better cycle is the current 'write, examine error message' of most IDEs, since it's faster and requires no context switch. Sure, editors can help there. IDEs do this by default. So it's normal of me to search for an IDE to better learn the language, I'll leave the emacs + console version for when I am productive in the language. 2) There are people working on building better easily portable native gui toolkits, but in many respects, a nice haskelly gui toolkit is still something people are experimetning with how to do well. theres lots of great tools out as of the past year or two, many more in progress on various time scales, and gtk2hs is great for linux (and thats fine). Unfortunately, this is not what's advertised. In fact, on the leksah site, the recommended method is to have the IDE installed via cabal. In another mail Mihai calls me unreasonable, but I think it's reasonable to think that the recommended method should be the one that works. But the easy to tell truth is that the Haskell Platform for Windows is not mature enough yet. That is something I can understand, and I can recommend other beginners to install a Linux VM for Haskell. That is perfectly fine, zero cost, 100% gain. However, the mistakes from the Haskell Platform as it is now on Windows should be pointed out, and although I've been called a mystical animal that
[Haskell-cafe] Diagrams and GTK
Hello, I am currently writing an application which draws the structure of some packets with help of the diagrams library directly to a GTK GUI. Now the packets can have several hundreds of parameters which have to be drawn so it takes some seconds to calculate the diagram itself. Of course this now blocks the GUI thread, so the basic idea was to put the calculation in a separate thread. Unfortunately this doesn't work as lazyness kicks in and the final diagram is calculated when it is rendered and not evaluated before. Using seq didn't help (because of WHNF) and there seems to be no deepseq instance for the diagrams. Does somebody has an idea on how to speed this up / get the diagram evaluated strictly as especially scrolling the DrawingArea is now really a pain? lg, Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Platform and Leksah on Windows
For those who want to be productive rather than talkative masoquists (thus said with all my love ;)), there are windows installers for Leksah and they work perfectly well. 2013/8/9 David Virebayre dav.vire+hask...@gmail.com Hi, If you go the EclipseFP approach, you may have installations troubles too. In my case, it was due to having a version of GHC and libraries that EclipseFP doesn't like. Once I got it to work, I loved it. David. 2013/8/8 Dorin Lazar dorin.la...@gmail.com: Hi, I understood what's wrong about my approach - and since I want to use an IDE to assist me, I will try both EclipseFP and Sublime Text, to see how that works. My feeling was that since the leksah website suggested that cabal is the way to do it and since when I search for a Haskell IDE that is it, then it was obvious that the recommended way doesn't work as it should. In my mind the platform was broken, I understand now that it's not the platform, just this special way of using it. I was also in awe of the fact that nobody really says anything about these difficulties, and felt like an estranged child that messed things up badly; however, it seems that the real issue is that nobody really does it that way, and I was wrong to actually try it like that. As I said (or haven't, but will) once I will get the hang of it I will recount my experience for others to follow, hopefully in better terms than this frustrating first experience. Many thanks for everyone's advice on the list, Dorin On Thu, Aug 8, 2013 at 9:48 PM, Carter Schonwald carter.schonw...@gmail.com wrote: Hey Dorin, I don't understand your claims. 1) haskell has worked perfectly well on windows for quite some time. I used HUGs nearly a decade ago, and in more recent time (2-3 years ago) I helped teach an introductory first computer science class using GHC where many students were doing great work using notepad++ and ghci. I don't understand your focus on emacs and make files. 2) if you want an IDE experience, Sublime Text with the right plugins, or perhaps EclipseFP are worth checking out. 3) likewise, if you're finding tooling on windows unsatisfactory, help fix it! Bug reports, patches, or new tools and libraries are always welcome. Haskell is a relatively small community, and thusly limited manpower (we're all volunteers), so way to fix any problem is help out! cheers On Thu, Aug 8, 2013 at 3:30 AM, Dorin Lazar dorin.la...@gmail.com wrote: Hello, I am the original author of the post, and I finally received the emails from the mailman (probably there was an issue with the automated requests). My answers are inlined. 1) Leksah should not be considered an official haskell ide, but merely one of many community supported editing tools. And frankly one of the less widely used ones at that! Leksah is not used much at all by anyone, though theres probably a handful of folks who do use it. Many folks use editors like Sublime Tex (2/3), Emacs, Vi(m), textmate, and many more. Its worth noting that the sublime-haskell plugin for sublime text, and analogous packages for many other editors, provide haskell IDE-like powers, or at least a nice subset thereof. Unfortunately, I think the problem with this is that we have a different vision on how development should be done. I have extensive experience of working from console, with a simple text editor and hand-made Makefiles or anything similar. However, an IDE should be a productivity tool, that can help you improve your understanding of the language, and can assist you in following the proper syntax for a new language. While learning by doing 'write, save, compile, examine error message' is ok with me, it is slow, and it limits the time I can dedicate to learning the language itself. A better cycle is the current 'write, examine error message' of most IDEs, since it's faster and requires no context switch. Sure, editors can help there. IDEs do this by default. So it's normal of me to search for an IDE to better learn the language, I'll leave the emacs + console version for when I am productive in the language. 2) There are people working on building better easily portable native gui toolkits, but in many respects, a nice haskelly gui toolkit is still something people are experimetning with how to do well. theres lots of great tools out as of the past year or two, many more in progress on various time scales, and gtk2hs is great for linux (and thats fine). Unfortunately, this is not what's advertised. In fact, on the leksah site, the recommended method is to have the IDE installed via cabal. In another mail Mihai calls me unreasonable, but I think it's reasonable to think that the recommended method should be the one that works. But the easy to tell truth is that the Haskell Platform for
[Haskell-cafe] Errors with Template Haskell
Hi, In Template Haskell, what is the proper way of signalling an error ? For example, you are generating code and you detect that a given parameter does not fulfill a precondition (e.g., String is empty), and you want to abort compilation with a descriptive error message. Thanks, Jose -- Jose Antonio Lopes Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Errors with Template Haskell
The Template Haskell quotation monad (Q) has proper support for fail: module A where import Language.Haskell.TH foo :: Q Exp foo = fail Custom compile error! and module B where import A main :: IO () main = print $foo gives B.hs:6:14: Custom compile error! In the first argument of `print', namely `$foo' In the expression: print ($foo) In an equation for `main': main = print ($foo) -E On Fri, Aug 9, 2013 at 9:48 AM, Jose A. Lopes jabolo...@google.com wrote: Hi, In Template Haskell, what is the proper way of signalling an error ? For example, you are generating code and you detect that a given parameter does not fulfill a precondition (e.g., String is empty), and you want to abort compilation with a descriptive error message. Thanks, Jose -- Jose Antonio Lopes Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370 ___ 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] Errors with Template Haskell
Thank you! -- Jose Antonio Lopes Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] starting GHC development -- two questions
You may also want to check out this freshly-minted page on the wiki: http://ghc.haskell.org/trac/ghc/wiki/Newcomers Every now and again, someone asks exactly the same question that you did, so I've created that page to help answer it. I hope you find it useful. Happy hacking! Richard On 2013-08-09 00:25, Ömer Sinan Ağacan wrote: Hello Edward, First off, welcome to the wonderful world of GHC development! I recommend that you subscribe to the ghc-devs mailing list and direct GHC specific questions there: http://www.haskell.org/mailman/listinfo/ghc-devs Thanks, I didn't know that. I subscribed and I will ask further questions to that list. GHC has a 'make tags' command but I've never gotten it to work. I have always just run 'hasktags .' in the compiler/ directory, which works pretty well for me. (If you're in the RTS, run ctags, etc instead) Great! It worked at the first try and I already started using it. We've been discussing putting together an easy bugs list. As a proxy, you can search on the 'Difficulty' keyword: http://ghc.haskell.org/trac/ghc/query?status=infoneededstatus=mergestatus=newstatus=patchdifficulty=Easy+(less+than+1+hour)col=idcol=summarycol=statuscol=typecol=prioritycol=milestonecol=componentorder=priority For example, this bug seems like a good beginner bug to get your feet wet with the RTS: http://ghc.haskell.org/trac/ghc/ticket/750 This one will give you some experience wrangling the test suite: http://ghc.haskell.org/trac/ghc/ticket/8079 Moving up to the moderate category, here is a nontrivial bug involving profiling and the optimizer: http://ghc.haskell.org/trac/ghc/ticket/609 As with all open source projects, there is always lots of infrastructural work to be done, so if that's your sort of thing, there are plenty of bugs in that category. Thanks, I'll start looking for issues with easy difficulty for now and ask further questions to ghc-devs mailing list. --- Ömer Sinan Ağacan http://osa1.net ___ 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] ANN: hi2 -- a better indentation mode for Emacs' haskell-mode
Hi, In the last 2-3 weeks I've been working on Haskell indentation inside Emacs. I had some annoyances for a long time and fixed some of them. The new mode is called hi2, it's heavily based on the current haskell-indentation (part of haskell-mode). The changes are mainly to the UI, although, I plan to have a look on the parser too. The code can be found on github: https://github.com/errge/hi2. Feel free to send me feedback, bug reports, pull requests, etc. It's also hosted on MELPA. The most notable changes so far are the following: - DEL and C-d is not mapped: if you want to indent backwards, you can use S-TAB. This means no random jumping on backspace anymore. - TAB steps to the right as before, but when the end is reached, it starts going to the left instead of wrapping around. - TAB stays inside the code, instead of going to the beginning of the line. As in pyhton-mode and perl-mode. - Region indentation common case is supported: TAB and S-TAB is simply moving the whole region to the left/right by 1-column. Can be pressed repeatedly. - The current indentations are shown as underscores in the current line. So you have some visual indication on what's gonna happen. Also useful while hacking on the parser and want to see the results. Can be turned off by setting hi2-show-indentations to nil in your init file or calling hi2-disable-show-indentations from the buffer. If there are collisions with other overlay hacking modes (e.g. fill-column-indicator), try to turn off hi2-show-indentations-after-eol. - The buffer is not changed when indentation is not changed (so there are no undo points created and no dirty flag in the buffer if pressing TAB had no effect). - The code for all this is somewhat commented and cleaned. I'm not trying to fork haskell-mode, it's maintained very actively on github and the maintainers were always friendly through code reviews. But the current haskell-indentation-mode required so many fixes that it became unpleasant to contribute patch-by-patch, I wanted to move fast. When (and if) hi2 gets stable and better in every respect than haskell-indentation-mode, I'm happy to merge and contribute it back. Gergely ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: hi2 -- a better indentation mode for Emacs' haskell-mode
On Fri, Aug 09, 2013 at 12:53:56PM +0200, Gergely Risko wrote: In the last 2-3 weeks I've been working on Haskell indentation inside Emacs. I had some annoyances for a long time and fixed some of them. The new mode is called hi2, it's heavily based on the current haskell-indentation (part of haskell-mode). The changes are mainly to the UI, although, I plan to have a look on the parser too. The code can be found on github: https://github.com/errge/hi2. Feel free to send me feedback, bug reports, pull requests, etc. Just tried it and I already like it! Thanks. Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why are field selectors functions?
Wouldn't the implementation hiding feature of the *newtype *idiom be broken, if field selectors were not first class functions? For instance, the following code (taken shamelessly from Ch. 10 of *Real World Haskell*): module Parse ( runParser ) where data ParseState = ParseState { string :: String } deriving (Show) newtype Parser a = Parser { runParser :: ParseState - Either String (a, ParseState) } has the attractive feature of hiding the internal implementation of the *ParseState *and *Parser *types from the user, preventing him from, for instance, pattern matching on either and thus writing code, which may break when we change the implementation. I believe this is only possible, because the *runParser *accessor is exportable as a first class function. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Alternative name for return
On Thu, Aug 8, 2013 at 7:40 AM, Timon Gehr timon.g...@gmx.ch wrote: You make the distinction between evaluate, Which essentially means applying reduction rules to an expression until the result is a value. and execute or run, etc. This is not functional. How would you know? I think Jerzy is alluding to the fact that we don't have a denotational semantics for IO. So I'm not sure I understand your response. Are you pointing out that some subspace of IO programs admit such a semantics via an easy inspection? 'putStr c' is a pure value. This is the crux of the matter: pure value means different things to different people. Some employ it to mean an effectful monadic expression to distinguish between getLine and (return Hello), both of type IO String. Others use it to distinguish between an ordinary Haskell expression and, say, C. So when you write: 'unsafePerformIO (putStr c)' is not a pure value. I infer you're in the latter camp. Would you then speak of 'effectful' values vs 'null-effectful' ones? What oral syntax would you actually use? -- Kim-Ee On Thu, Aug 8, 2013 at 7:40 AM, Timon Gehr timon.g...@gmx.ch wrote: On 08/08/2013 01:19 AM, Jerzy Karczmarczuk wrote: Bardur Arantsson comments the comment of Joe Quinn: On 8/7/2013 11:00 AM, David Thomas wrote: twice :: IO () - IO () twice x = x x I would call that evaluating x twice (incidentally creating two separate evaluations of one pure action description), but I'd like to better see your perspective here. x is only evaluated once, but/executed/ twice. For IO, that means magic. For other types, it means different things. For Identity, twice = id! Your point being? x is the same thing regardless of how many times you run it. What do you mean by the same thing? You cannot compare 'them' in any reasonable sense. ... http://en.wikipedia.org/wiki/**Identity_of_indiscernibleshttp://en.wikipedia.org/wiki/Identity_of_indiscernibles (He is reasoning _about_ the language and not _within_ the language because Haskell does not support very powerful reasoning internally.) ... You make the distinction between evaluate, Which essentially means applying reduction rules to an expression until the result is a value. and execute or run, etc. This is not functional. How would you know? Your program doesn't run anything, it applies (=) (or equivalent) to an IO (...) object. This is the only practical evaluation of it, otherwise it can be passed (or duplicated as above). But you cannot apply bind twice to the same instance of it (in fact, as I said above, the same instance is a bit suspicious concept...). ... Indeed, but you didn't say that above. The running or execution takes place outside of your program. In such a way Richard O'Keefe and I converge... That's why I say that the concept of purity is meaningless in the discussed context. Not meaningless, but redundant. The point of having a purely functional programming language is to have reasoning based on purity be universally applicable. It is a kind of counterfeit notion, inherited from pure functions to something which belongs to two different worlds. ... 'putStr c' is a pure value. On the other hand: 'unsafePerformIO (putStr c)' is not a pure value. (But this expression does not exist in standard Haskell. unsafePerformIO unquotes the action. You may be confusing the quoted and unquoted versions.) __**_ 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
[Haskell-cafe] translate imperative pseudo code into haskell
I would need some help to get to a reasonable function involving the DB read, addition and multiplication. for 0 = i row dimension of A for 0 = j column dimension of B for 0 = k column dimension of A = row dimension of B sum += (read A (i,k))* (read B(k,j)) I started like this but then somehow lost the compass: main = do map my.read (map (\(x,y) - matrixA: ++ show row ++ : ++ show column) [ (i, j, k) | i - [1..50], j - [1..20], k - [1..30] ]) Can you pls help? --Joerg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: hi-0.0.2, a Haskell project generator
Hello cafe, I'm very happy to announce the release of hi, a Haskell project generator. http://hackage.haskell.org/package/hi This application will generate a scaffold for new Haskell project with given command line argument(or value in configuration file), using git repository as a template. If you frequently create new project which has test suite in hspec, generating new project by hi will be a good alternative to cabal-init. It comes with test suite in hspec and already buildable. A project made by the default configuration is here. https://github.com/fujimura/hi-example More details is in the README: https://github.com/fujimura/hi Hope you enjoy it :-) -- Fujimura Daisuke http://fujimuradaisuke.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] translate imperative pseudo code into haskell
On 2013-08-09 17:04, Joerg Fritsch wrote: I would need some help to get to a reasonable function involving the DB read, addition and multiplication. for 0 = i row dimension of A for 0 = j column dimension of B for 0 = k column dimension of A = row dimension of B sum += (read A (i,k))* (read B(k,j)) I started like this but then somehow lost the compass: main = do map my.read (map ((x,y) - matrixA: ++ show row ++ : ++ show column) [ (i, j, k) | i - [1..50], j - [1..20], k - [1..30] ]) You could treat lists as monads and write code which looks very much like your pseudo code, something like this -- A few dummy definitions to make 'products' typecheck. data Matrix = Matrix rows :: Matrix - Int rows = undefined columns :: Matrix - Int columns = undefined readValue :: Matrix - (Int, Int) - Int readValue = undefined -- This is one way to write your pseudo code in Haskell products :: Matrix - Matrix - Int products a b = sum $ do i - [1..rows a] j - [1..columns b] k - [1..columns a] return $ readValue a (i, k) * readValue b (k, j) -- Frerich Raabe - ra...@froglogic.com www.froglogic.com - Multi-Platform GUI Testing ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] translate imperative pseudo code into haskell
On 2013-08-09 17:28, Frerich Raabe wrote: On 2013-08-09 17:04, Joerg Fritsch wrote: for 0 = i row dimension of A for 0 = j column dimension of B for 0 = k column dimension of A = row dimension of B sum += (read A (i,k))* (read B(k,j)) [..] -- This is one way to write your pseudo code in Haskell products :: Matrix - Matrix - Int products a b = sum $ do i - [1..rows a] j - [1..columns b] k - [1..columns a] return $ readValue a (i, k) * readValue b (k, j) It just occurred to me that the ranges of i, j and k are not quite correct, e.g. [1..rows a] should be [0..rows a - 1] to match your pseudo code. That aside, 'products' is probably not a very appropriate name. In any case, you could also keep your approach of building all 3-tuples and then map a function which turns the tuples into products over the list, like: products :: [(Int, Int, Int)] - [Int] products = map (\i j k - readA (i, j) * readB (k, j)) ...and then call 'sum' on that. This function actually deserves the name. :-) -- Frerich Raabe - ra...@froglogic.com www.froglogic.com - Multi-Platform GUI Testing ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Diagrams and GTK
Hi Michael, On 09/08/13 08:21, Michael Oswald wrote: Hello, I am currently writing an application which draws the structure of some packets with help of the diagrams library directly to a GTK GUI. Now the packets can have several hundreds of parameters which have to be drawn so it takes some seconds to calculate the diagram itself. Of course this now blocks the GUI thread, so the basic idea was to put the calculation in a separate thread. Unfortunately this doesn't work as lazyness kicks in and the final diagram is calculated when it is rendered and not evaluated before. Using seq didn't help (because of WHNF) and there seems to be no deepseq instance for the diagrams. Does somebody has an idea on how to speed this up / get the diagram evaluated strictly as especially scrolling the DrawingArea is now really a pain? Cairo is thread safe* so you could render the whole thing (if it isn't super huge dimensions) to an image surface in the background thread, then displaying could be a matter of copying the correct part (for scrolling) of the surface to the DrawingArea. Something like this perhaps (untested, incomplete): 8 import qualified Diagrams.(...) as D import qualified Graphics.Rendering.Cairo as C renderDiaToSurface width height diagram = do let w' = fromIntegral width h' = fromIntegral height opts = D.CairoOptions (D.Dims w' h') D.RenderOnly False (_, render) = D.renderDia D.Cairo opts diagram surface - C.createImageSurface C.FormatARGB32 width height C.renderWith surface render return surface ... 8 Hope this is useful, Claude * I had some very rare crashes in heavily threaded code, still not found the root cause... -- http://mathr.co.uk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Some philosophy (Was: Alternative name for return)
I have the impression that a nice part of our dispute comes from the fact that despite our ambitions, and a decent /technical/ level of understanding of what we are talking about, most of us are (and I am one of the worst...) -- -- pitiful philosophers... Really bad... Confusing the contents and the function/role of the entities, using ambiguous definitions (and confounding objects with their definitions), et j'en passe. Sigh. I decided to reread some philosophical texts, and I suggest one for your evening reading. Indiscrete Thoughts by Gian-Carlo Rota, published by Birkhäuser in 1997. Available on the Web. Rota was an active *mathematician* and teacher, and the sense of mathematical constructs was very important for him. It is a very refreshing book, you won't be disappointed. (It contains also some personal views of Rota on his fellows mathematicians. And the analysis of the difference between characters who are problem solvers, as contrasted with theoreticians... Rota was a strong personality, full of obsessions, and his ideas on the soundness of formal thinking may not convince you, but you should find them interesting. And you will find inside that for Rota the term should is very important, even if it impossible to define...) Many thanks to Olivier Danvy, who recommended me this book! Jerzy Karczmarczuk Caen, France. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Some philosophy (Was: Alternative name for return)
On Fri, Aug 9, 2013 at 5:44 PM, Jerzy Karczmarczuk jerzy.karczmarc...@unicaen.fr wrote: I have the impression that a nice part of our dispute comes from the fact that despite our ambitions, and a decent /technical/ level of understanding of what we are talking about, most of us are (and I am one of the worst...) -- -- pitiful philosophers... I just leave this here, Analytic Philosophy: An Anthology http://www.amazon.com/gp/product/0631216472 -- happy hacking... man ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Some philosophy (Was: Alternative name for return)
On Fri, Aug 9, 2013 at 10:44 PM, Jerzy Karczmarczuk jerzy.karczmarc...@unicaen.fr wrote: I decided to reread some philosophical texts, and I suggest one for your evening reading. Indiscrete Thoughts by Gian-Carlo Rota, published by Birkhäuser in 1997. Available on the Web. I'm rather fond of Rota's two volumes of musings. For the purpose of furthering the quality of philosophizing, would it not be better served citing the relevant chapters, if not the actual page numbers? As you took note, the book covers a swathe of topics. -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installling Leksah on ghc7.6.3 with haskell-platform 2013?
On 09/08/13 16:35, Hamish Mackenzie wrote: You will need Leksah 0.13 for GHC 7.6.3 and it is not in Hackage yet. It is almost ready though. If run git clone https://github.com/leksah/leksah.git cd leksah cabal install cabal-meta cabal-src cabal-meta install It would be interesting to know if it works for you. On an up to date Debian Wheezy system with ghc 7.6.3, haskell platform 2013, git 1.7.10.4: ✓ 11:51:58 carlo@x1 (master) ~/tmp/leksah $ cabal-meta install git fetch origin git checkout master Already on 'master' git submodule foreach git pull origin master You need to run this command from the toplevel of the working tree. cabal-meta: log of commands saved to: /home/carlo/tmp/leksah/.shelly/1.txt Exception: error running: git submodule foreach git pull origin master exit status: 1 stderr: You need to run this command from the toplevel of the working tree. So instead I tried the initial git clone with --recursive, but there are some fatal errors (references that are not in the tree?). ✓ 12:01:44 carlo@x1 ~/tmp $ git clone --recursive https://github.com/leksah/leksah.git Cloning into 'leksah'... WARNING: gnome-keyring:: couldn't connect to: /home/carlo/.cache/keyring-yZXClI/pkcs11: No such file or directory remote: Counting objects: 8930, done. remote: Compressing objects: 100% (2431/2431), done. remote: Total 8930 (delta 6145), reused 8824 (delta 6044) Receiving objects: 100% (8930/8930), 17.53 MiB | 538 KiB/s, done. Resolving deltas: 100% (6145/6145), done. Submodule 'vendor/CodeMirror' (g...@github.com:ghcjs/CodeMirror.git) registered for path 'vendor/CodeMirror' Submodule 'vendor/ghcjs-dom' (g...@github.com:ghcjs/ghcjs-dom.git) registered for path 'vendor/ghcjs-dom' Submodule 'vendor/haskellVCSGUI' (g...@github.com:leksah/haskellVCSGUI.git) registered for path 'vendor/haskellVCSGUI' Submodule 'vendor/haskellVCSWrapper' (g...@github.com:leksah/haskellVCSWrapper.git) registered for path 'vendor/haskellVCSWrapper' Submodule 'vendor/jsc' (g...@github.com:ghcjs/jsc.git) registered for path 'vendor/jsc' Submodule 'vendor/leksah-server' (g...@github.com:leksah/leksah-server.git) registered for path 'vendor/leksah-server' Submodule 'vendor/ltk' (g...@github.com:leksah/ltk.git) registered for path 'vendor/ltk' Submodule 'vendor/pretty-show' (g...@github.com:leksah/pretty-show.git) registered for path 'vendor/pretty-show' Submodule 'vendor/vado' (g...@github.com:hamishmack/vado.git) registered for path 'vendor/vado' Submodule 'vendor/webkit-javascriptcore' (g...@github.com:ghcjs/webkit-javascriptcore.git) registered for path 'vendor/webkit-javascriptcore' Submodule 'vendor/yi' (g...@github.com:leksah/yi.git) registered for path 'vendor/yi' Cloning into 'vendor/CodeMirror'... X11 forwarding request failed on channel 0 remote: Counting objects: 14210, done. remote: Compressing objects: 100% (6388/6388), done. remote: Total 14210 (delta 8658), reused 13125 (delta 7792) Receiving objects: 100% (14210/14210), 2.95 MiB | 543 KiB/s, done. Resolving deltas: 100% (8658/8658), done. Submodule path 'vendor/CodeMirror': checked out '107612c9e854c61ed3aa94bee29a136438085557' Cloning into 'vendor/ghcjs-dom'... X11 forwarding request failed on channel 0 remote: Counting objects: 813, done. remote: Compressing objects: 100% (483/483), done. remote: Total 813 (delta 578), reused 546 (delta 313) Receiving objects: 100% (813/813), 363.52 KiB | 173 KiB/s, done. Resolving deltas: 100% (578/578), done. Submodule path 'vendor/ghcjs-dom': checked out 'c347df82e86136851b9d132d1c71d18ecb3f9f2a' Cloning into 'vendor/haskellVCSGUI'... X11 forwarding request failed on channel 0 remote: Counting objects: 1239, done. remote: Compressing objects: 100% (533/533), done. remote: Total 1239 (delta 688), reused 1227 (delta 677) Receiving objects: 100% (1239/1239), 13.05 MiB | 537 KiB/s, done. Resolving deltas: 100% (688/688), done. Submodule path 'vendor/haskellVCSGUI': checked out '5aaf804587c9e8b34dd669390666cdbcba564e4c' Cloning into 'vendor/haskellVCSWrapper'... X11 forwarding request failed on channel 0 remote: Counting objects: 1019, done. remote: Compressing objects: 100% (432/432), done. remote: Total 1019 (delta 569), reused 1008 (delta 558) Receiving objects: 100% (1019/1019), 2.66 MiB | 525 KiB/s, done. Resolving deltas: 100% (569/569), done. Submodule path 'vendor/haskellVCSWrapper': checked out '00e0ed2f007a8ca68d1b8a4ebf66a86b572b9647' Cloning into 'vendor/jsc'... X11 forwarding request failed on channel 0 remote: Counting objects: 221, done. remote: Compressing objects: 100% (146/146), done. remote: Total 221 (delta 95), reused 149 (delta 27) Receiving objects: 100% (221/221), 48.26 KiB, done. Resolving deltas: 100% (95/95), done. Submodule path 'vendor/jsc': checked out '99047d74b7036a4bf9172af548b9c80498f7a3c9' Cloning into 'vendor/leksah-server'... X11 forwarding request failed on channel 0 remote: Counting objects: 950, done. remote: Compressing objects: 100% (437/437), done.
Re: [Haskell-cafe] Importing more modules by default
Cool, BasicPrelude solves my problem perfectly! On Thu, Aug 8, 2013 at 7:04 AM, David McBride toa...@gmail.com wrote: I've started using BasicPrelude with -XNoImplicitPrelude in all of my code. It imports all of those and some other stuff as well (text related functions). Cuts down on my imports by a little over half. Kind of wish it could be made the default. On Wed, Aug 7, 2013 at 10:23 PM, aditya bhargava bluemangrou...@gmail.com wrote: Hi there, It seems like every Haskell program I write imports the following modules: Control.Monad Control.Applicative Data.Maybe Data.List Is there a good reason why these modules aren't imported by default? When I write a simple script usually a 1/4th of the script is just imports, and my code just looks uglier. Adit ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- adit.io ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe