[Haskell-cafe] implementing a text editor swap file
I'm writing a gtk2hs-based text editor, and would like to implement continuous (swap-file based) autosave the way vim and emacs do it. Any suggestions for how to implement this in a cross-platform manner? Also, is there a library that returns standard config file locations on a per-platform basis? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] implementing a text editor swap file
Says posix only. But googling for it brought up System.IO.MMap, which does seem to be cross-platform. martin On Tue, Jan 17, 2012 at 5:46 PM, Matthew Farkas-Dyck strake...@gmail.com wrote: http://hackage.haskell.org/package/bytestring-mmap On 17/01/2012, Martin DeMello martindeme...@gmail.com wrote: I'm writing a gtk2hs-based text editor, and would like to implement continuous (swap-file based) autosave the way vim and emacs do it. Any suggestions for how to implement this in a cross-platform manner? Also, is there a library that returns standard config file locations on a per-platform basis? martin ___ 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] implementing a text editor swap file
On Tue, Jan 17, 2012 at 5:49 PM, Erik de Castro Lopo mle...@mega-nerd.com wrote: Matthew Farkas-Dyck wrote: http://hackage.haskell.org/package/bytestring-mmap Since he's editing text, its a pity there isn't a text-mmap package :-). Further question - my internal data representation is a vector of strings (it's a line-based editor). Is there a more efficient strategy to keep an mmap buffer in sync with the vector than simply allocating some large fixed size per line? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] implementing a text editor swap file
On Tue, Jan 17, 2012 at 6:24 PM, Erik de Castro Lopo mle...@mega-nerd.com wrote: Martin DeMello wrote: Further question - my internal data representation is a vector of strings (it's a line-based editor). String or ByteString or Text? If its either of the first two, I think you should definitely look at Text. Just plain String, mostly because it's what Gtk.Entry works with. I'll take a look at Text. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] typeclass and functional dependency problem
I'm writing a Gtk2hs app, and I have several custom widgets that are composite objects represented by records, one field of which is a container widget. I am trying to write a replacement for gtk2hs's boxPackStart boxPackStart :: (BoxClass self, WidgetClass child) = self - child - Packing - Int - IO () that will accept either a gtk widget or one of my custom widgets to place in the box, and do the right thing. Here's my attempt at it; what I want to know is why the commented out bit didn't work and I had to individually add instances of widgets instead: - -- packable objects class WidgetClass w = Packable a w | a - w where widgetOf :: a - w --instance WidgetClass w = Packable w w where --widgetOf = id instance Packable Button Button where widgetOf = id instance Packable Entry Entry where widgetOf = id instance Packable Label Label where widgetOf = id instance Packable Notebook Notebook where widgetOf = id instance Packable HBox HBox where widgetOf = id -- add widget to box boxPackS :: (BoxClass b, WidgetClass w, Packable a w) = b - a - Packing - Int - IO () boxPackS box child p i = boxPackStart box (widgetOf child) p i - If I try to use instance WidgetClass w = Packable w w where widgetOf = id instead, I get the compilation error Editor.hs:23:10: Functional dependencies conflict between instance declarations: instance Packable PairBox VBox -- Defined at Editor.hs:23:10-30 instance WidgetClass w = Packable w w -- Defined at GuiUtils.hs:13:10-38 even though PairBox does not belong to WidgetClass. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How hard is it to start a web startup using Haskell?
A good compromise might be opa (not used it myself, but I've been reading up on it as a possible candidate for any personal web projects I might want to do). It is not haskell, but it is ML-derived, and specifically for webapps. It has some example apps available, though nothing near the volume of apps rails or django would have. martin On Mon, Dec 26, 2011 at 6:17 PM, Haisheng Wu fre...@gmail.com wrote: Turns out that those guys doing start-up with Haskell are already expert at Haskell. Hence choosing Haskell is more straightforward. I'm thinking of using Haskell since it looks cool and beautiful. However I have little experience and will move slowly at certain begging period. This sounds not good to a startup company. Comparing with Django in Python, Rails in Ruby, yesod and snap looks not that mature. Also, for instance, I'd like to build up a CRM application company, I could leverage some open source projects in other languages. In Haskell, we need to build from scratch basically. Appreciate your suggestions/comments. -Simon On Wed, Dec 21, 2011 at 2:30 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Dec 19, 2011 at 2:36 PM, Yves Parès limestr...@gmail.com wrote: Haskell is a mature platform that provides lots of goodies that I might otherwise have to write (like the goodies I wrote in Lift including an Actors library) I don't get it: Actors are at the core of Scala concurrency model, Actors as implemented in the Scala distribution were (and probably still are) horrid. They have poor performance, memory retention issues, and an overall poor design. When Lift relied on Scala's Actors, a Lift-comet site needed to be restarted every few weeks because of pent-up memory issues. On the other hand, with Lift Actors, http://demo.liftweb.net has been running since July 7th. and are expanded for distributed programming through Akka for instance. Actually, no. Scala's Actors are not expanded by Akka (although Akka Actors may replace the existing Actor implementation in the Scala library). Akka is yet another replacement for Scala's Actor library and Akka's distributed capabilities are weak and brittle. Also, Lift's Actor library and Martin Odersky's flames about it paved the way for Akka because I took the heat that might have driven Jonas out of the Scala community when Akka was a small project. To me it'd be the other way around: you'd have to develop Actors in Haskell, don't you? I've come to understand that Actors are a weak concurrency/distribution paradigm. Anything that has a type signature Any = Unit is not composable and will lead to the same kinds of issues that we're looking for the compiler in Haskell to help us with (put another way, if you like Smalltalk and Ruby, then Actors seem pretty cool.) On the other hand, many of Haskell's libraries (STM, Iteratees, etc.) have a much more composable set of concurrency primitives. Or maybe you don't mean the same thing by 'Actor'? 2011/12/19 David Pollak feeder.of.the.be...@gmail.com On Mon, Dec 19, 2011 at 2:04 AM, Ivan Perez ivanperezdoming...@gmail.com wrote: I'm actually trying to make a list of companies and people using Haskell for for-profit real world software development. I'd like to know the names of those startups, if possible. I am building http://visi.pro on Haskell. I am doing it for a number of reasons: Haskell is a mature platform that provides lots of goodies that I might otherwise have to write (like the goodies I wrote in Lift including an Actors library) Haskell allows a lot of nice things that make building a language and associated tools easier (like laziness) Haskell is a filter for team members. Just like Foursquare uses Scala as a filter for candidates in recruiting, I'm using Haskell as a filter... if you have some good Haskell open source code, it's a way to indicate to me that you're a strong developer. -- Ivan On 18 December 2011 18:42, Michael Snoyman mich...@snoyman.com wrote: On Sun, Dec 18, 2011 at 6:57 PM, Gracjan Polak gracjanpo...@gmail.com wrote: Hi all, The question 'How hard is it to start a technical startup with Haskell?' happened a couple of times on this list. Sometimes it was in the form 'How hard is to find Haskell programmers?' or 'Are there any Haskell jobs?'. I'd like to provide one data point as an answer: http://www.reddit.com/r/haskell/comments/ngbbp/haskell_only_esigning_startup_closes_second_angel/ Full disclosure: I'm one of two that founded this startup. How are others doing businesses using Haskell doing these days? I don't run a startup myself, but I know of at least three startups using Haskell for web development (through Yesod), and my company is basing its new web products on Yesod as well. I think there are plenty of highly qualified Haskell programmers out there, especially if you're willing to let someone work
Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?
On Tue, Dec 20, 2011 at 3:10 PM, Chris Wong chrisyco+haskell-c...@gmail.com wrote: Why not expand it even further? class Monoid m where (•) :: m - m - m (∅) :: m (∈) :: (Foldable t, Eq a) = a - t a - Bool (∘) :: (b - c) - (a - b) - (a - c) (∧) :: Bool - Bool - Bool etc. We can write a whole Haskell library full of these aliases -- syntactic-heroin perhaps? ;) Why would you go that far and still not have → ? (: martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] indentation blues
On Tue, Dec 13, 2011 at 2:34 AM, Adrien Haxaire adr...@haxaire.org wrote: Regarding, your question whether this is worth switching from vim to emacs. I've been using both editors for some years and I very much doubt, that you wouldn't spend much time learning emacs. If you are comfortable with vim, stick with it, unless you are interested in Emacs or one of its really great modes: org and auctex/reftex. Regarding, the vi emulations, I'd say they are nice should you ever be forced to use emacs for some time. But I don't recommend them, I've tried them all. They are not the real thing. Most of them are vi not vim emulators. And they always feel like second class citizens in emacs land. YMMW. Thanks for your feedback. I've never tried vim so I couldn't tell precisely. I thought the emulations were nice enough to save time learning emacs. If they are second class citizens, I agree it would be wiser to stick with vim then. yeah, i was assuming the emulations were nice enough to support my vim habits too. if they aren't, not even a good haskell mode would make emacs comfortable enough to use given my years of ingrained vim. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] indentation blues
The vim autoindent for haskell is really bad :( Is there a better indent.hs file floating around somewhere? Alternatively, is the emacs haskell mode better enough that it's worth my time learning my way around emacs and evil? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] minor refactoring problem
I have the following functions: makePair :: (String, String) - IO PairBox parseFile :: String - [(String, String)] importFile :: Editor - String - IO () importFile ed path = do s - readFile path ps - mapM (\x - makePair (x, )) (lines s) es - return $ V.fromList ps writeIORef ed es loadFile :: Editor - String - IO () loadFile ed path = do s - readFile path ps - mapM makePair (parseFile s) es - return $ V.fromList ps writeIORef ed es The problem is that loadFile and importFile are so similar it seems a shame not to combine them somehow, but anything I can think of doing leaves the code looking more rather than less messy. Any nice ideas? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] minor refactoring problem
On Tue, Nov 29, 2011 at 12:35 AM, Stefan Holdermans ste...@vectorfabrics.com wrote: Have you considered abstracting over the bits in which importFile and loadFile differ? For example: processFile :: (String - IO [PairBox]) - Editor - String - IO () processFile f ed path = do s - readFile path ps - f s es - return $ V.fromList ps writeIORef ed es importFile = processFile (mapM (\x - makePair (x, )) . lines) loadFile = processFile (mapM makePair . parseFile) This was what I had tried; my issue was that the resulting code looked harder rather than easier to read, so it felt more like golfing than refactoring. Or, alternatively: processFile :: (String - [a]) - (a - IO PairBox) - Editor - String - IO () processFile f g ed path = do s - readFile path ps - mapM g (f s) es - return $ V.fromList ps writeIORef ed es importFile = processFile lines (\x - makePair (x, )) loadFile = processFile parseFile makePair This does look significantly nicer - I hadn't thought of splitting it into two functions rather than one, but it makes the code look much less cluttered. (The trick with `flip` is tempting, but again at the cost of having to peer rather too closely at the implementation of processFile when reading the code). Thanks! martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] minor refactoring problem
On Tue, Nov 29, 2011 at 12:55 AM, Stefan Holdermans ste...@vectorfabrics.com wrote: Martin, (The trick with `flip` is tempting, but again at the cost of having to peer rather too closely at the implementation of processFile when reading the code). That trick is of course completely orthogonal. One could just as well write: processFile :: (String - [a]) - (a - (String, String)) - Editor - String - IO () processFile f g ed path = do s - readFile path ps - mapM (makePair . g) (f s) es - return $ V.fromList ps writeIORef ed es importFile = processFile lines (\x - (x, )) loadFile = processFile parseFile id good point :) though i ended up writing a new function parseImport = (map $ \x - (x, )) . lines, so that i could drop the second argument and have everything look nice and neat. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Unix emulation
On Sun, Aug 22, 2010 at 5:04 PM, Stephen Tetley stephen.tet...@gmail.com wrote: Andrew, I was going to chastise you for being the only Windows developer who has problems with MinGW / MSYS and spreading that unpleasant internet commodity FUD. However, I've just gone back to mingw.org and its gone from somewhat confusing circa the last time I installed (Christmas 2009) to frankly abysmal. So while is was easy to install MinGW / MSys a year ago I'll willing concede that it is difficult now. Agreed. I tried to set up an msys development environment to compile chicken scheme a couple of weeks ago, and, quite frankly, gave up. I settled for installing mingw and putting the mingw bin directory first in my cygwin path. This worked very well indeed, even though it isn't an officially supported chicken build environment, so it's worth experimenting with for haskell as well. (Note that it needs a reboot of windows after setting up the cygwin environment variables; I never figured out why). martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Anything like Mythryx in Haskell?
Mythryl [http://mythryl.org/] is an ML dialect that mostly puts an Algolish syntax and some good posix interoperability atop SML/NJ. More than the language (which doesn't seem to be as tastefully designed as Haskell, particularly in terms of syntax - what do people have against MLish syntax anyway?) I like the goals of the associated Mythryx project [http://mythryl.org/my-Mythryx.html], namely, to develop a well-engineered unixy ecosystem in a strongly typed functional language. Has anyone attempted something like this in Haskell? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Bangalore
Sure, sounds like fun :) I keep trying to learn Haskell and getting nowhere, but the thing is I keep trying! martin On Mon, Jun 21, 2010 at 10:00 AM, C K Kashyap ckkash...@gmail.com wrote: Hi, I was wondering if it would be a good idea for the folks interested in Haskell in Bangalore to get together. Especially if there are folks at EGL, perhaps we could just meet up at pyramid. I've been trying to learn Haskell for a while and currently am trying to work through SPJ's implementation of Functional Programming languages. It would be good to bounce off ideas (in person) with like minded folks. -- Regards, Kashyap ___ 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 at Indian Universities?
On Tue, Mar 30, 2010 at 2:07 AM, Joachim Breitner m...@joachim-breitner.de wrote: I’m a computer science student in Germany and I’d like to spend one semester as an exchange student in India. I have no specific plans yet where I want to go, and I’m wondering if there are universities in India where Haskell is basis for research or at least used as a tool. Haskell and functional programming is quite underrepresented at my university, so maybe this might be a good opportunity for me to combine Haskell and academia. Here's a prof at IIT-Bombay who's into Haskell; you could write to him for further suggestions. http://www.cse.iitb.ac.in/~as martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Idea for a very simple GUI llibrary
Has there been real world adoption of any of these, in the shape of a moderately complex end-user application that is not just a library demo? martin On Mon, Nov 23, 2009 at 8:48 AM, Keith Holman hol...@gmail.com wrote: You should also check out Fudgets and Tangible Functional Programming. Fudgets is a really old Haskell UI library concept; Tangible FP is a recent Google talk about a UI library inspired by Haskell types. 2009/11/22 Luke Palmer lrpal...@gmail.com: Nice idea. I will try it if you write runGUI :-) This is an imperative style library. For more Haskellian GUI library ideas, see Fruit (http://www.haskell.org/fruit/) and TVs (http://www.haskell.org/haskellwiki/TV). They may not pass the builds constraint :-P Luke 2009/11/22 Maurício CA mauricio.antu...@gmail.com: Hi, Here is a sketch for a library with these properties: - Easy to test. All Haskell code can be tested in a text terminal. Also, testing code that uses the library can also be done without using a GUI. - Extremely easy to document and use. - Not even close to Gtk2hs power, but enough for small applications. - Could be the first GUI to build on hackage :) What we need is: - MyState. A user suplied type for application state. - WidId. A user suplied type for widget identifiers. - Gui wi. A type capable of describing an interface with all of its state. It's an instance of Eq. - Event wi. A type for events. - Prop. A type for properties than can related to a WidId. Running an application would be like this: main = runGUI initState -- An initial MyState. event -- :: MyState - DiffTime - Event WidId - MyState props -- :: WidId - [Prop] action -- :: MyState - DiffTime - IO (Maybe (MyState,Gui WidId)) timeout -- :: DiffTime DiffTime parameters for callbacks are always the time elapsed since application started. From initState and event, the implementation of runGUI can save a state that optionally changes with time. From props, it can get details on what to present in widgets associated with a WidId (selected state, picture to draw etc.). action presents a chance for using IO, and optionally change state and GUI description. timeout is the maximum time runGUI implementation is allowed to wait between calls to action. Examples for those types: newtype MyState = { lastUpdate :: DiffTime, builtGui :: Bool, earthCoordinates :: (Double,Double), map :: SVG, ... } data WidId = XCoord | YCoord | MapWindow | ReloadButton ... data Gui widid = TitleWindow (Gui widid) | Tabs [(String,Gui widid)] | PressButton String widid | Selection [String] widid | ... deriving Eq {- Eq is needed by runGUI to detect if GUI has changed after the last call to action. -} data Event widid = ButtonPressed widid | FileSelected String widid | OptionSelected String widid | ... data Prop widid = Active Bool | Text String | Draw SVG | ... I believe this can represent most kinds of simple applications, and be efficient enough for practical use. It's interesting that all of this can be designed, implemented and tested independent of runGUI implementation. Actually, if you want a pet project and want to write and design the Haskell part, I may probably be able to write runGUI for you :) Best, Maurício ___ 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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graph drawing library for Haskell
On Fri, Nov 20, 2009 at 9:36 PM, Victor Mateus Oliveira rhapso...@gmail.com wrote: I'm looking for something more integrated with a gui library. The jgraph integrates with swing, so you can move, create, delete, have popup menus, select nodes, and so on. I haven't found yet.. If there isn't, I thinking in create one lib with wxHaskell using wxDC... But by now, I really prefer to use one existing library. Blobs [http://www.cs.york.ac.uk/fp/darcs/Blobs/] might be a better starting point than implementing from scratch on wxdc martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What's the deal with Clean?
On Wed, Nov 4, 2009 at 10:34 AM, Richard O'Keefe o...@cs.otago.ac.nz wrote: (4) It comes with its own IDE. I don't think it can do anything much that Haskell tools can't do, but if you don't like looking for things, it's a help. And a well-integrated GUI toolkit. If it weren't for the Windows bias I'd have definitely taken the time to learn the language. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] looking for a 2d graphics package
What 2d graphics library would be the best fit for this sort of thing? http://www.superliminal.com/geometry/tyler/gallery/circular/tiles060.html I took a look at diagrams but it seemed more geared towards things that fit on a rectangular layout. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] clean's gui toolkit
I've been wondering - Clean ships with a fairly capable looking GUI toolkit [http://clean.cs.ru.nl/About_Clean/Standard_I_O_Lib/standard_i_o_lib.html] - has anyone used it? How does it compare to the available Haskell options? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Arch Haskell News: Jan 11 2009
On Mon, Jan 12, 2009 at 4:00 AM, Don Stewart d...@galois.com wrote: Arch Haskell News: Jan 11 2009 Hey all, welcome to the first Arch Haskell News of 2009. (News about Haskell on the Arch Linux platform). Arch now has 827 Haskell packages in AUR. FWIW I just replaced gentoo[1] on my desktop with arch, at least in part due to this sort of community enthusiasm :) [1] i was going to replace it anyway, but wasn't sure what with martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
Something incorporating λ∀ perhaps martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Efficient parallel regular expressions
On Tue, Nov 4, 2008 at 9:05 AM, Martijn van Steenbergen [EMAIL PROTECTED] wrote: For my mud client Yogurt (see hackage) I'm currently working on improving the efficiency of the hooks. Right now several hooks, each consisting of a regex and an action can be active at the same time. Every time a line of input is available (usually several times a second) I run the line through all the available regexes and execute the first matching action. I figured this is not the cleverest approach and it'd be better if I |'ed all regexes into one big DFA. However, how do I then find out which of the original hooks matched and so which action to execute? Is this really a problem in practice? I've done similar things in Ruby, which is a much slower language, and not had any issues - particularly in something IO bound like a MUD client it doesn't seem that running down a few tens of regexps would be a bottleneck of any sort. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Interesting new user perspective
On Fri, Oct 10, 2008 at 2:31 PM, Jonathan Cast [EMAIL PROTECTED] wrote: On Fri, 2008-10-10 at 17:13 -0400, Steve Schafer wrote: On Fri, 10 Oct 2008 11:05:43 -0700, Jonathan Cast wrote: No reason not to expose newcomers to Haskell to the thing it does best. This is precisely why newcomers flounder. Newcomers flounder because they expect to keep programming the same way they always have. They should be (and *are*) taught better ways of doing things. http://blog.moertel.com/articles/2006/10/18/a-type-based-solution-to-the-strings-problem is a brilliant example of a common workaday problem found in other languages, and solved elegantly in Haskell martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Model-driven development (was: Haskell participting in big science like CERN Hadrian...)
2008/10/4 Jason Dagit [EMAIL PROTECTED]: 3) Write a python generating EDSL in Haskell strong arguements against it. The main problem with #3, is that if I share code with other devs they have to learn Haskell and my EDSL since they won't be able to just hack the generated python, similar problem with #4. Also, An option is to generate python via an edsl, and use the object oriented trick of overriding the generated code in a separate file. I've done that fairly successfully when generating java from a ruby edsl and some templates, for example. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal upgrade
On Tue, Sep 30, 2008 at 9:01 PM, Duncan Coutts [EMAIL PROTECTED] wrote: On Wed, 2008-10-01 at 01:59 +0200, Cetin Sert wrote: A reminder: When I wanted to upgrade to yi 0.4.6.2, I needed to download the new package list cabal update #download list of new packages cabal upgrade #make any upgrades Note that 'cabal upgrade' upgrades everything you've currently got installed (which in general is not necessarily possible). The standard workflow is just: cabal update#download list of new packages cabal install yi#install latest version of yi $ cabal install yi Resolving dependencies... 'yi-0.4.6.2' is cached. Configuring yi-0.4.6.2... cabal: alex version =2.0.1 3 is required but it could not be found. cabal: Error: some packages failed to install: yi-0.4.6.2 failed during the configure step. The exception was: exit: ExitFailure 1 $ cabal install yi-gtk Resolving dependencies... cabal: cannot configure yi-gtk-0.2.1. It requires sourceview =0.9.11 There is no available version of sourceview that satisfies =0.9.11 Trying cabal upgrade didn't fix it - it still throws the same error. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal upgrade
On Wed, Oct 1, 2008 at 1:04 PM, Svein Ove Aas [EMAIL PROTECTED] wrote: On Wed, Oct 1, 2008 at 9:52 PM, Martin DeMello [EMAIL PROTECTED] wrote: $ cabal install yi Resolving dependencies... 'yi-0.4.6.2' is cached. Configuring yi-0.4.6.2... cabal: alex version =2.0.1 3 is required but it could not be found. cabal: Error: some packages failed to install: yi-0.4.6.2 failed during the configure step. The exception was: exit: ExitFailure 1 $ cabal install yi-gtk Resolving dependencies... cabal: cannot configure yi-gtk-0.2.1. It requires sourceview =0.9.11 There is no available version of sourceview that satisfies =0.9.11 Trying cabal upgrade didn't fix it - it still throws the same error. This is because the sourceview package is not on hackage - it's legacy, non-cabal code and can be found on http://www.haskell.org/gtk2hs/ You'll have to install it manually, I'm afraid. It's not just yi-gtk, though - yi itself isn't installing via cabal, due to the alex version =2.0.1 3 dependency. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] csv one-liner
2008/10/1 wman [EMAIL PROTECTED]: PS: Sorry, Andrew, that I first posted the reply directly to you, still getting used to the fact that gmail kindly replies to the user on whose behalf the message was sent, not to the list. I think that's a list setting, not a gmail one. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal upgrade
On Wed, Oct 1, 2008 at 1:06 PM, Gwern Branwen [EMAIL PROTECTED] wrote: Yi fails on Alex because Cabal doesn't track executables, nor executables needed for installation. You want 'cabal install alex yi'; Yay, that finally worked :) Had to add ~/.cabal/bin to my path first, which wasn't hard to figure out but should probably also be in a faq somewhere. I believe the FAQ covers this. Nope. I was following http://www.haskell.org/haskellwiki/Yi when I got stuck, and the page makes no mention of how to resolve the alex dependency As for cabal install yi-gtk, unless things have changed since I last looked, the answer is Don't Do That. yi-gtk and yi-vty are solely for yi 0.3 and below - it's obsolete, in other words. Yi depends directly on vty (which cabal install will handle) and GTK2HS, which unfortunately is not on Hackage and so you or your distro has to handle that. Okay, thanks :) martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Shooting your self in the foot with Haskell
2008/10/1 Joachim Breitner [EMAIL PROTECTED]: You shoot the gun, but nobody notices because no-one evaluates the target. Who'd've thunk it! m. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Shooting your self in the foot with Haskell
On Wed, Oct 1, 2008 at 3:39 PM, Bill [EMAIL PROTECTED] wrote: On Wed, 2008-10-01 at 16:46 -0400, John Van Enk wrote: . . . I fully realize how un-clever this is. Some one please give me something more worth of the original list. :) You shoot the gun but nothing happens (Haskell is pure, after all). putting the unsafe in unsafePerformIO! martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: (A little humour)
On Fri, Sep 26, 2008 at 1:03 PM, Achim Schneider [EMAIL PROTECTED] wrote: Miguel Mitrofanov [EMAIL PROTECTED] wrote: I think you might be interested in http://www.research.att.com/~bs/whitespace98.pdf Instead, it was decided to by default limit identifiers to a single character The Wisdom of it! Preparing C++ programmers for Haskell's limitation! \\ was pure genius too martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] cabal on ubuntu
I'm running Ubuntu 8 (Hardy Heron), and while trying to install cabal ran into this bug: https://bugs.launchpad.net/ubuntu/+source/haskell-cabal/+bug/231099 I finally had to install cabal manually, but it took me a lot of googling to be sure that was the right thing to do. Could someone who knows more than me put a howto in the ubuntu wiki https://wiki.ubuntu.com/MOTU/Teams/UncommonProgrammingLanguages/Haskell and/or the haskell one http://www.haskell.org/haskellwiki/GNU/Linux#Ubuntu ? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] calling setWMHints (expects a CInt, I have an Int)
Could someone give me an example of calling setWMHints from Graphics.X11.Xlib.Extras? The signature is setWMHints :: Display - Window - WMHints - IO Status and WMHints is defined as data WMHints = WMHints { wmh_flags :: CLong wmh_input :: Bool wmh_initial_state :: CInt wmh_icon_pixmap :: Pixmap wmh_icon_window :: Window wmh_icon_x :: CInt wmh_icon_y :: CInt wmh_icon_mask :: Pixmap wmh_window_group :: XID } I can't figure out how to convert an Int to a CInt to construct the WMHints martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] calling setWMHints (expects a CInt, I have an Int)
On Wed, Jul 2, 2008 at 2:16 PM, Neil Mitchell [EMAIL PROTECTED] wrote: Hi Martin, I can't figure out how to convert an Int to a CInt to construct the WMHints Ask Hoogle: http://haskell.org/hoogle/?q=Int+-%3E+CInt Nice And Hoogle says: toEnum, fromIntegral thanks a lot :) martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] what's up with hackage.haskell.org?
haven't been able to get to it in a couple of days (at least) martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] what's up with hackage.haskell.org?
On Fri, Jun 27, 2008 at 9:25 AM, Simon Peyton-Jones [EMAIL PROTECTED] wrote: | Subject: [Haskell-cafe] what's up with hackage.haskell.org? | | haven't been able to get to it in a couple of days (at least) It's offline for 24 hrs while Galois move office. Ah, okay :) Just noticed it when I tried to click on a google result that pointed there. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] haskell and dockapps
Anyone written a windowmaker dockapp in Haskell? I thought it'd be a fun project, but I don't quite know where to start. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] getting set up in ubuntu
I finally ditched sabayon for ubuntu (one wireless problem too many), and now I'm slowly getting stuff set up on it. Any Ubuntu people care to share their experiences? I'm especially looking for guidelines on what to install via apt-get and what to install independently. Also, while I'm making Major Life Changes I might as well check out xmonad :) If anyone has made the switch from fluxbox, do share how it went. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] getting set up in ubuntu
On Thu, Jun 5, 2008 at 12:47 AM, Ketil Malde [EMAIL PROTECTED] wrote: Martin DeMello [EMAIL PROTECTED] writes: I'm especially looking for guidelines on what to install via apt-get and what to install independently. I'd get as much as possible via apt-get, and only install manually when that fails. Thanks! Did you have any conflicts between manual and apt-got stuff? Is there any equivalent to gentoo's package.provided (which basically says 'I have installed this manually; please don't try to update it for me')? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] FW: Haskell
On Tue, Apr 1, 2008 at 3:41 PM, Dan Weston [EMAIL PROTECTED] wrote: Nor did I use to take perfectly working code and refactor it until it cried for mercy, and then stay awake wondering if there was some abstraction out there I was missing that would really make it sing. I find myself doing this in Scheme and Ruby too - it's actually one of my rules-of-thumb for picking languages that I'd like to invest in. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Best Linux for Haskell?
On 11/6/07, Maurício [EMAIL PROTECTED] wrote: Maybe (and only maybe), before choosing a distribution, you should choose a package system, since that's what you are going to use to install software. Look for RPM and APT, and see what you think. With my package system (I don't wanna give you any prejudice, so I won't tell you it's APT), I can get upgrades easily. But that's because I know how to use it. There are also other options beside RPM and APT. Gentoo's portage (inspired by FreeBSD's ports) is the best linux packaging system I've come across, but I wouldn't recommend Gentoo itself as a first distro. It makes a brilliant second one, though. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] New slogan for haskell.org
On 10/5/07, Don Stewart [EMAIL PROTECTED] wrote: It has been suggested we could just sit DrScheme in front of ghc/ghci. Anyone with experience who'd like to step up for this? Note that there's a DrOCaml, which might be a good starting point. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] renderString problems
On 8/26/07, Sven Panne [EMAIL PROTECTED] wrote: This is actually not a bug, but a feature. :-) From the Haddock docs for renderString: Render the string in the named font, without using any display lists. Rendering a nonexistent character has no effect. If the font is a bitmap font, renderString automatically sets the OpenGL unpack pixel storage modes it needs appropriately and saves and restores the previous modes before returning. The generated call to bitmap will adjust the current raster position based on the width of the string. If the font is a stroke font, translate is used to translate the current model view matrix to advance the width of the string. The rational behind this is that you set a position once, and subsequent multiple renderString calls will render the individual strings one after the other, just like printf appends strings on the output. If this is not clear from the documentation, any suggestions how to improve the docs? Why not add the rationale to the docs too? Invoking printf should make the thing jump into focus for anyone who hasn't got it. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] gui libs? no thanks, i'm just browsing.. ;-)
On 7/19/07, Claus Reinke [EMAIL PROTECTED] wrote: the idea is well known: build your app as a server, and put an ajax-based gui in front of it, even if server and browser run on the same machine. A more desktopy alternative: http://www.gtk-server.org/ martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A real Haskell Cookbook
On 2/26/07, Chris Eidhof [EMAIL PROTECTED] wrote: Hey everyone, we added some examples to this page. There are some topics that don't have any examples, notably: # 11 Network Programming # 12 XML * 12.1 Parsing XML # 13 Databases * 13.1 MySQL * 13.2 PostgreSQL * 13.3 SQLite # 14 FFI * 14.1 How to interface with C If anyone feels like filling up some of those sections, that would be great. I'd also suggest adding * 4.4 Regular expressions * 4.5 Interpolation martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Map list of functions over a single argument
On 2/22/07, Gene A [EMAIL PROTECTED] wrote: The functions as I originally defined them are probably easier for someone new to Haskell to understand what was going on than the rather stark ($ a) in the final factoring of the function... Though the final resulting function is far the cleaner for that notation! This is what I came up with when I was experimenting: map (\f - f $ a) fs which then helped me to see it could be rewritten as just map ($ a) fs martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] still wrestling with io
Code here: http://zem.novylen.net/anagrid.html I've got an instance of IO appearing unexpectedly and I can't figure out where from. It throws up the following error: $ ghc --make test.hs Chasing modules from: test.hs Compiling Main ( test.hs, test.o ) test.hs:38:15: Couldn't match `StaticText ()' against `IO (StaticText ())' Expected type: StaticText () Inferred type: IO (StaticText ()) In the application `staticText p [text := (labelText a b)]' In the definition of `textOf': textOf p a b = staticText p [text := (labelText a b)] martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Newbie: generating a truth table
On 2/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, how would you convert Boolean triples to strings, in the IO function? printStrings :: (Bool,Bool,Bool) - IO () Take a look at 'show': Prelude show True True martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] nested maybes
On 2/5/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello J., Sunday, February 4, 2007, 11:46:57 PM, you wrote: exists s wmap = isJust $ find (==s) . snd = Map.lookup (sort s) wmap exists s wmap = Map.lookup (sort s) wmap == snd == find (==s) == isJust a==b = a=return.b Very nice! Didn't know about ==. Thanks to everyone else who responded too; I'm learning a lot from this thread. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] mixing wxhaskell state and file io
On 2/5/07, Martin DeMello [EMAIL PROTECTED] wrote: On 2/5/07, Matthew Brecknell [EMAIL PROTECTED] wrote: This is probably what you wanted (untested): w - readWords words words - varCreate w That didn't work, because (as someone on #haskell explained to me) readWords has type IO and the wx actions have type Layout Okay, I was probably doing something else wrong, because I just tried this again (after changing some other code) and it worked perfectly. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] nested maybes
I have a Data.Map.Map String - (Layout, [String]) as follows: type Anagrams = [String] type Cell = (Layout, Anagrams) type WordMap = Map.Map String Cell exists str wmap = let a = Map.lookup (sort str) wmap in case a of Nothing - False Just x - case (find (== str) (snd x)) of Nothing - False _ - True the existence test looks ugly - any more compact way to write it? martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] mixing wxhaskell state and file io
I'm having a lot of trouble mixing file io and wxhaskell's varCreate/Get/Set functions. I have functions readWords :: String - IO WordMap wordGrid :: WordMap - Layout And within my GUI code, the following compiles (ignores the variable, basically): words - varCreate (do {w - readWords words; return w}) wGrid - do w - readWords words return $ wordGrid w but I can't get the following (noncompiling code, but it shows what I'm trying to do) working: wGrid - do w - varGet words return $ wordGrid w Could someone give me a minimal example of reading in a list of words from a file, binding a wxHaskell variable to the list, and then mapping some GUI code over it? (Also, I'm making the base assumption that varSet and varGet are wxHaskell's analogue of the State monad - should I be looking at using StateT instead?) martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] mixing wxhaskell state and file io
On 2/5/07, Matthew Brecknell [EMAIL PROTECTED] wrote: I'm not familiar with wxHaskell, but I don't think wxHaskell is your problem here. It looks like you are confusing yourself with overuse of do notation, and perhaps a lack of understanding of the monad laws. Whenever you see this: v - expr return v You can replace it with just expr. Your code above reduces to: words - varCreate (readWords words) Okay - was confused about that. Thanks for the tip. So the variable you are creating has type (IO WordMap), when you probably wanted it to have type WordMap. By itself, this compiles, because IO actions are values as good as any other. The problem only manifests when you combine it with code that tries to read the variable as if it had type WordMap. This is probably what you wanted (untested): w - readWords words words - varCreate w That didn't work, because (as someone on #haskell explained to me) readWords has type IO and the wx actions have type Layout The wxHaskell Var type is not quite like the State monad. It is a type of mutable variable in the IO monad, much like the IORef type. Try to avoid gratuitous use of mutable variables, as they can weaken your ability to reason about your code. I'm not convinced you really need one here. What problem are you trying to solve by using a mutable variable? You're right, I don't need mutable variables, just some sort of state. I'm writing a game which presents the user with a list of anagrams (read in from a file) and an input box in which to enter guesses. The input box's on command is (pseudocode) a - get input text if exists a wordmap remove a wordmap update display else say wrong So what I need is for the gui code to have a single wordmap threaded through it. I thought I could do that by reading in the wordmap within the gui do sequence and binding it to a variable. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Suggestions for a hReadUntilStr implementation
On 2/3/07, Matt Revelle [EMAIL PROTECTED] wrote: hReadUntilStr :: (Num a) = Handle - String - a - IO (String, Bool) Is this the wrong way to think about the problem? If so, how should it be handled? If not, any ideas on the implementation? Sounds like this would grow into a full-fledged expect-type program, in which case http://www.informatik.uni-bremen.de/uniform/wb/ is probably worth a look. martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Let's welcome the Ruby hackers!
On 2/1/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: So a big hello to any Ruby/Rails hackers lurking out there! Free lambdas for all if you drop by #haskell... I came to Haskell from Ruby the first time around, but didn't have anything real to write in it so I lost steam somewhat. This time I'm here following the parser combinator trail, so hopefully it'll stick :) martin p.s. Is there a collection of parsec parsers for various languages maintained anywhere? I hunted around but didn't find anything. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe