Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming
Can GUI programming be liberated from the IO monad? From a layman's point of view, aren't structures like enumerators/iteratees more suited to deal with IO? Or maybe they just wouldn't apply in the case of GUI... 2011/7/8 Heinrich Apfelmus apfel...@quantentunnel.de Dear Haskellers, Can GUI programming be liberated from the IO monad? Functional Reactive Programming (FRP) promises as much, and I'm trying to make this dream a reality with my [reactive-banana][] library. Having released version 0.4.0.0, I am now looking for example programs to direct the future evolution of the library. Do you know any *small GUI programs* that you would *like* to see *implemented with Functional Reactive Programming?* I'm sure that some of you * are interested in FRP and would like to learn from a few simple but beautiful examples * or have written small GUI programs that they are unhappy with because they were not purely functional * or have thought about FRP before and concocted a few examples that are very tricky to implement with FRP * or have written a nice little GUI application that simply makes a great example. I would love to hear your examples, so that I can try to convert them to FRP style and test my library against them! Strictly speaking, it doesn't have to be an example with a graphical interface, I'm also interested in audio and animation examples, though I'm currently focusing on GUIs. Here a few examples of what I am looking for: * I think that Tim Docker's minimal step sequencer [hbeat][] simply makes a great example. I hope that wxHaskell offers a platform-independent way to play sound. * While editing the [Haskell Weekly News][hwn], Brent Yorgey wrote a little command-line [program to gather newsworthy items][zipedit]. But wouldn't a GUI be great? Since I'm only interested in the GUI, someone would have to supply the feed parser for this example to be viable. Maybe the current editor, Daniel Santa Cruz, might be interested? * Notes of a musical performance can be modeled as event streams (MIDI), as Henning Thielemann has [done with great effect][midi streams]. Surely, reactive-banana should be up to the task, but writing an arpeggiator seems impossible at the moment. [reactive-banana]: http://hackage.haskell.org/**package/reactive-bananahttp://hackage.haskell.org/package/reactive-banana [zipedit]: http://byorgey.wordpress.com/**2008/06/21/zipedit/http://byorgey.wordpress.com/2008/06/21/zipedit/ [hbeat]: http://dockerz.net/twd/hBeat [midi streams]: http://hackage.haskell.org/**package/streamedhttp://hackage.haskell.org/package/streamed [hwn]: http://www.haskell.org/**haskellwiki/Haskell_Weekly_**Newshttp://www.haskell.org/haskellwiki/Haskell_Weekly_News Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Inconsistent trailing comma in export list and record syntax
Hello, I'm wondering why the trailing comma is allowed in export syntax, but not in record syntax, here an example module Foo ( export1, -- is allowed ) where data Type = Type { record1 :: Foo, -- is not allowed } To me this seems quite inconsistent and sometimes quite frustrating, imagine the case that you want to temporarily remove the last record: data Type = Type { record1 :: Foo, --record2 :: Bar } this would fail due to an extra comma that has to be commented out. You could of course say that I'm using a bad style, but it remains that it seems to be inconsistent to allow a trailing comma in one place and not in the other. So is there an reason for this? Lars Corbijn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Inconsistent trailing comma in export list and record syntax
On 11 July 2011 10:49, L Corbijn aspergesoe...@gmail.com wrote: You could of course say that I'm using a bad style, but it remains that it seems to be inconsistent to allow a trailing comma in one place and not in the other. So is there an reason for this? I've also noticed that I can write data X = X deriving Show But not import Prelude hiding print But we can write x :: Foo x = … x :: (Foo x) = … Can write class X But not module X I wouldn't expect that there are particular argued reasons for these inconsistencies. It's difficult to balance a consistent syntax in a language while trying to be convenient. I don't think it matters too much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Inconsistent trailing comma in export list and record syntax
Well, for your example frustration, the leading comma style would sort your problem nicely. As for the particulars… hmm, not sure. I use leading commas for both, so I never really noticed. It may be that since modules simply expose functions to other programs, the form is syntactically irrelevant except when the module is being loaded. I am quite curious about it now, though, so I hope there are some more knowledgeable folks with some input. On Jul 11, 2011, at 4:49 AM, L Corbijn wrote: Hello, I'm wondering why the trailing comma is allowed in export syntax, but not in record syntax, here an example module Foo ( export1, -- is allowed ) where data Type = Type { record1 :: Foo, -- is not allowed } To me this seems quite inconsistent and sometimes quite frustrating, imagine the case that you want to temporarily remove the last record: data Type = Type { record1 :: Foo, --record2 :: Bar } this would fail due to an extra comma that has to be commented out. You could of course say that I'm using a bad style, but it remains that it seems to be inconsistent to allow a trailing comma in one place and not in the other. So is there an reason for this? Lars Corbijn ___ 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] Inconsistent trailing comma in export list and record syntax
On Jul 11, 2011, at 11:42 AM, Jack Henahan wrote: Well, for your example frustration, the leading comma style would sort your problem nicely. As for the particulars… hmm, not sure. I use leading commas for both, so I never really noticed. That just shifts the problem, I think? Now you can no longer comment out the first line. -- Sjoerd Visscher ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Inconsistent trailing comma in export list and record syntax
On Mon, Jul 11, 2011 at 11:51 AM, Sjoerd Visscher sjo...@w3future.com wrote: On Jul 11, 2011, at 11:42 AM, Jack Henahan wrote: Well, for your example frustration, the leading comma style would sort your problem nicely. As for the particulars… hmm, not sure. I use leading commas for both, so I never really noticed. That just shifts the problem, I think? Now you can no longer comment out the first line. I've found this quite annoying, especially when using CPP to conditionally include something in a list, as it might force you to reorder the list to make the commas appear correctly when the conditional section is enabled/disabled. Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Inconsistent trailing comma in export list and record syntax
Hi, Am Montag, den 11.07.2011, 10:49 +0200 schrieb L Corbijn: You could of course say that I'm using a bad style, but it remains that it seems to be inconsistent to allow a trailing comma in one place and not in the other. So is there an reason for this? there is actually a bug report against the ghc package in Debian from a user, requesting a more liberal comma separated list parsing. We did not patch ghc in Debian to that end, though :-) http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511834 Greetings, Joachim -- Joachim nomeata Breitner m...@joachim-breitner.de | nome...@debian.org | GPG: 0x4743206C xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Inconsistent trailing comma in export list and record syntax
That just shifts the problem, I think? Now you can no longer comment out the first line. If you are using to-end-of-line comments with --, then the likelihood of noticing a leading ( or { on the line being commented, is much greater than the likelihood of noticing a trailing comma on the end of the line _before_ the one you are commenting. Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Inconsistent trailing comma in export list and record syntax
On Mon, Jul 11, 2011 at 3:54 PM, Henning Thielemann thunderb...@henning-thielemann.de wrote: Johan Tibell wrote: I've found this quite annoying, especially when using CPP to conditionally include something in a list, as it might force you to reorder the list to make the commas appear correctly when the conditional section is enabled/disabled. In this case I use the colon like a terminator. http://www.haskell.org/haskellwiki/List_notation Sorry, I wasn't being clear. I meant for import/export lists. Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] External system connections
On 07/10/11 15:37, Felipe Almeida Lessa wrote: You don't need to do it, it is already done =). See the pool package by Michael Snoyman on Hackage [1]. More specifically, see createPoolCheckAlive [2]. Cheers, [1] http://hackage.haskell.org/package/pool [2] http://hackage.haskell.org/packages/archive/pool/0.1.0.2/doc/html/Data-Pool.html#v:createPoolCheckAlive How do people use this stuff? The README is empty, there's no documentation, and none of the functions are commented. I'm forced to conclude that there are people capable of looking at this, createPoolCheckAlive :: MonadControlIO m = IO a - (a - IO ()) - Int - (Pool a - m b) - (a - IO Bool) - m b and knowing immediately what it does. I'm still a beginner, and I don't think I have a use for this package (what does it do?), but I've run into similar situations with other packages and would genuinely like to know (as opposed to just complain about it). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] External system connections
On Mon, Jul 11, 2011 at 11:27, Michael Orlitzky mich...@orlitzky.com wrote: How do people use this stuff? The README is empty, there's no documentation, and none of the functions are commented. I'm forced to conclude that there are people capable of looking at this, I can *almost* work it out just from the type and knowing what it should be doing. But in this case, the main problem is that it was split off of yesod (http://www.yesodweb.com/), and it was only documented in the context of that. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] External system connections
On Mon, Jul 11, 2011 at 12:27 PM, Michael Orlitzky mich...@orlitzky.com wrote: How do people use this stuff? The README is empty, there's no documentation, and none of the functions are commented. I'm forced to conclude that there are people capable of looking at this, createPoolCheckAlive :: MonadControlIO m = IO a - (a - IO ()) - Int - (Pool a - m b) - (a - IO Bool) - m b and knowing immediately what it does. Yes, there's a documentation problem. But you can guess by the types =). IO a: opens a new resource a. a - IO (): disposes the given resource. Int: maximum number of open resources. Pool a - m b: the action you want to execute; after it executes, the pool is destroyed. a - IO Bool: check if the resource is still alive. m b: the result of running your given action with a new pool. The key to understanding all of this is looking backwards from the result. 1) The result is m b. Where did this come from? 2) Well, there's a 'Pool a - m b'. So it runs the action for me. So this is like a 'withFile :: FilePath - (Handle - IO a) - IO a' function. 3) So if it is a 'Pool a', then the resource is of type 'a'. 4) The only function returning 'a' is 'IO a', so this creates the resource. 5) By the same reason, 'a - IO ()' disposes it. 6) 'a - IO Bool' is confusing, but there's a doc for that. 7) 'Int' is also confusing, but since this is a pool, this must be the maximum number of open resources. HTH, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] External system connections
Have you looked at Bryan O'Sullivan's resource-pool[1] library? I've used it with MySQL, Redis and Riak connection pooling. It's been robust and easy to use. It seems like it would be a good fit for your application. Cheers, Ozgun [1] http://hackage.haskell.org/package/resource-pool On Sun, Jul 10, 2011 at 3:04 PM, Richard Wallace rwall...@thewallacepack.net wrote: Hello all, I'm trying to understand how to properly structure a connection to an external system. I'm writing an application that processes requests (it's an IRC bot - ya, I've looked at lambabot but it's a bit beyond my current understanding and I'm really trying to learn this stuff and find the best way to do that is to write it myself) and sends requests to an external system, via SOAP. The SOAP requests should be sent on separate threads. The SOAP server requires an initial request for authentication be made to obtain a token used on subsequent requests. There are three ways I can structure this. One is to do the authentication with the SOAP server when the application starts up and just use that token for all subsequent requests. This will fall over if the token times out and I'd have to restart the application. Another way is to do authenticate with the server and get a new token for each request. This is obviously really inefficient. What I'd like to do is something a bit smarter. When a request to the SOAP server is to be made, if we have a token then we try and use it. If it fails, we reauthenticate and get a new token. When establishing a new token, other threads trying to send SOAP requests should block until a new token is available. There are other conditions that should be handled - such as an exponential back-off when the SOAP server can't be reached - but I feel like reestablishing the authentication token is really the key concern here. Unfortunately, I have no idea right now how to write this in Haskell. Any pointers would be awesome. Thanks! Rich ___ 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] External system connections
On 07/11/11 11:41, Felipe Almeida Lessa wrote: Yes, there's a documentation problem. But you can guess by the types =). IO a: opens a new resource a. a - IO (): disposes the given resource. Int: maximum number of open resources. Pool a - m b: the action you want to execute; after it executes, the pool is destroyed. a - IO Bool: check if the resource is still alive. m b: the result of running your given action with a new pool. The key to understanding all of this is looking backwards from the result. 1) The result is m b. Where did this come from? 2) Well, there's a 'Pool a - m b'. So it runs the action for me. So this is like a 'withFile :: FilePath - (Handle - IO a) - IO a' function. 3) So if it is a 'Pool a', then the resource is of type 'a'. 4) The only function returning 'a' is 'IO a', so this creates the resource. 5) By the same reason, 'a - IO ()' disposes it. 6) 'a - IO Bool' is confusing, but there's a doc for that. 7) 'Int' is also confusing, but since this is a pool, this must be the maximum number of open resources. Magic, got it =) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] IterIO: How to write use my inumReverse
Sorry, my previous message got truncated. I was trying to say that many iteratees like iterReverse can be defined nicely using combinators from Control.Applicative. You end up with much cleaner code. Also, iterLines doesn't work as the name would suggest. It only consumes one line from the input stream and returns it inside a singleton list. Instead, iterLines can be defined like this: iterLines :: (Monad m) = Iter L.ByteString m [L.ByteString] iterLines = do el - tryBI lineI case el of -- no more full lines left, return the remaining data Left (e :: SomeException) - (:[]) $ dataI -- read one line; add it to the list and read more Right line - (line:) $ iterLines enumPure line1\nline2\nline3 |$ iterLines [Chunk line1 Empty,Chunk line2 Empty,Chunk line3 Empty] However, the above returns the resulting list only after consuming the whole stream, which is something to avoid. In case of iterReverse it is better to read and accumulate characters until \n is found and then return the reversed string. One way to do this is to read one character at a time: reverseLineSlow :: Iter L.ByteString IO L.ByteString reverseLineSlow = iter where iter acc = do c - headI case c of 10 - return $ L.reverse acc _ - iter (acc `mappend` L.singleton c) But this will be really slow. Instead, the data should be read one chunk at a time: reverseLine :: Iter L.ByteString IO L.ByteString reverseLine = iter where iter acc = do -- read the data from the stream one chunk at a time Chunk c eof - chunkI -- check if there is any \n, i.e. if we read a whole line let (a,b) = L.break (==10) c if b == -- haven't found any \n yet; append all data to the accumulator then iter (acc `mappend` a) -- have found \n else do -- put the data after \n back (while removing \n itself) ungetI $ L.tail b -- return reversed accumulator plus the data up to \n return $ L.reverse $ acc `mappend` a Hope this helps! -- Maciej On Tue, Jul 12, 2011 at 12:47 AM, Maciej Wos maciej@gmail.com wrote: Don't forget Applicative instance! iterReverse = L.reverse $ lineI On Monday, 4 July 2011 at 22:54, dm-list-haskell-c...@scs.stanford.edu wrote: At Mon, 4 Jul 2011 20:36:33 +1000, John Ky wrote: Hi Haskell Cafe, enum |$ inumLines .| inumReverse .| inumUnlines .| iter ... iterLines :: (Monad m) = Iter L.ByteString m [L.ByteString] iterLines = do line - lineI return [[line] iterUnlines :: (Monad m) = Iter [L.ByteString] m L.ByteString iterUnlines = (L.concat . (++ [C.pack \n])) `liftM` dataI iterReverse :: (Monad m) = Iter [L.ByteString] m [L.ByteString] iterReverse = do lines - dataI return (map L.reverse lines) inumLines = mkInum iterLines inumUnlines = mkInum iterUnlines inumReverse = mkInum iterReverse It all works fine. My question is: Is it possible to rewrite inumReverse to be this: iterReverse :: (Monad m) = Iter L.ByteString m L.ByteString iterReverse = do line - dataI return (L.reverse line) inumReverse = mkInum iterReverse And still be able to use it in the line: enum |$ inumLines .| {-- inumReverse goes in here somehow --} .| inumUnlines .| iter The reason I ask is that the Haskell function reverse has the type [a] - [a], not [[a]] - [[a]]. I thought perhaps the alternative inumReverse is cleaner than the original as it behaves more similarly to Haskell's own reverse function. I'm not sure what you are trying to achieve. If you want an iter that works on L.ByteStrings, then you can say: iterReverse :: (Monad m) = Iter L.ByteString m L.ByteString iterReverse = do line - lineI return (L.reverse line) In that case you don't need inumLines and inumUnlines. If, however, you want the type to be [L.ByteString], and you would rather do this one line at a time, instead of calling map, then you could do something like the following: iterReverse :: (Monad m) = Iter [L.ByteString] m [L.ByteString] iterReverse = do line - headI return [L.reverse line] But the code you have above should also work, so it all depends on what you are trying to achieve. David ___ 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] Monad.Reader #19 call for copy -- special issue on parallelism and concurrency
Call for Copy: The Monad.Reader - Issue 19 SPECIAL ISSUE on parallelism and concurrency Whether you're an established academic or have only just started learning Haskell, if you have something to say, please consider writing an article for The Monad.Reader! Issue 19 will be a special issue focusing on parallelism and concurrency, construed broadly. The submission deadline for Issue 19 will be: **Tuesday, August 16** The Monad.Reader The Monad.Reader is a electronic magazine about all things Haskell. It is less formal than journal, but somehow more enduring than a wiki- page. There have been a wide variety of articles: exciting code fragments, intriguing puzzles, book reviews, tutorials, and even half-baked research ideas. Submission Details ~~ Get in touch with me if you intend to submit something -- the sooner you let me know what you're up to, the better. Please submit articles for the next issue to me by e-mail (byorgey at cis.upenn.edu). Articles should be written according to the guidelines available from http://themonadreader.wordpress.com/contributing/ Please submit your article in PDF, together with any source files you used. The sources will be released together with the magazine under a BSD license. If you would like to submit an article, but have trouble with LaTeX please let me know and we'll work something out. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Inconsistent trailing comma in export list and record syntax
On Mon, 11 Jul 2011, Johan Tibell wrote: On Mon, Jul 11, 2011 at 3:54 PM, Henning Thielemann thunderb...@henning-thielemann.de wrote: Johan Tibell wrote: I've found this quite annoying, especially when using CPP to conditionally include something in a list, as it might force you to reorder the list to make the commas appear correctly when the conditional section is enabled/disabled. In this case I use the colon like a terminator. http://www.haskell.org/haskellwiki/List_notation Sorry, I wasn't being clear. I meant for import/export lists. But in import/export lists you can use the trailing comma, and thus you can conditionally export or import identifiers at any position. However, the trailing comma is forbidden in enumerations of constructors. E.g. import M (R, S, T, ) is allowed, but not import M (T(A,B,C,)) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] External system connections
On Mon, Jul 11, 2011 at 6:27 PM, Michael Orlitzky mich...@orlitzky.com wrote: On 07/10/11 15:37, Felipe Almeida Lessa wrote: You don't need to do it, it is already done =). See the pool package by Michael Snoyman on Hackage [1]. More specifically, see createPoolCheckAlive [2]. Cheers, [1] http://hackage.haskell.org/package/pool [2] http://hackage.haskell.org/packages/archive/pool/0.1.0.2/doc/html/Data-Pool.html#v:createPoolCheckAlive How do people use this stuff? The README is empty, there's no documentation, and none of the functions are commented. I'm forced to conclude that there are people capable of looking at this, createPoolCheckAlive :: MonadControlIO m = IO a - (a - IO ()) - Int - (Pool a - m b) - (a - IO Bool) - m b and knowing immediately what it does. I'm still a beginner, and I don't think I have a use for this package (what does it do?), but I've run into similar situations with other packages and would genuinely like to know (as opposed to just complain about it). Author of the package speaking. I agree, that's a problem :). I've just uploaded a new version[1] that is properly documented, though it will take a bit for Hackage to generates the Haddocks. As Brandon said, the reason this wasn't documented in the first place is that it was an internally used module for Persistent that I decided after the fact to release separately. As for Bryan's resource-pool: currently I would strongly recommend *against* using it for any purpose. It is based on MonadCatchIO-transformers[2], which is a subtly broken package. In particular, when I tried using it for pool/persistent in the first place, I ended up with double-free bugs from SQLite. As an abridged history, I ended up writing a replacement called MonadInvertIO, which later was superceded by MonadPeelIO[3] and MonadControlIO[4]. The latter two packages are both much more correct that MonadCatchIO, and either one should be used in its place. I did email Bryan about this a bit ago, but he didn't get back (he *is* a very busy guy). Ideally, I think that we don't need to have both pool and resource-pool, but such is the situation right now. Michael [1] http://hackage.haskell.org/package/pool-0.1.0.3 [2] http://hackage.haskell.org/package/MonadCatchIO-transformers-0.2.2.2 [3] http://hackage.haskell.org/package/monad-peel [4] http://hackage.haskell.org/package/monad-control-0.2.0.1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] The Typeable class is changing
Simon Marlow has announced[1] on the Haskell Libraries list that the Typeable class is changing. The standard way to create a Typeable instance is just to derive it. If you do that, you will not be affected by this change. But it seems that many packages create Typeable instances by explicitly using mkTyCon. If your package does this, it will eventually break, after a deprecation period. Please respond to this thread if you own a package that will be affected by this change. Can someone who has quick access to the entire contents of Hackage please do a grep and find out exactly which packages on Hackage will be affected? Thanks. -Yitz [1] http://www.haskell.org/pipermail/libraries/2011-July/016546.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] External system connections
On 07/11/11 13:49, Michael Snoyman wrote: Author of the package speaking. I agree, that's a problem :). I've just uploaded a new version[1] that is properly documented, though it will take a bit for Hackage to generates the Haddocks. As Brandon said, the reason this wasn't documented in the first place is that it was an internally used module for Persistent that I decided after the fact to release separately. Thanks for humoring me. I guess I'll begin tracking down other authors and making them feel guilty! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] External system connections
On Mon, Jul 11, 2011 at 10:49 AM, Michael Snoyman mich...@snoyman.comwrote: I did email Bryan about this a bit ago, but he didn't get back [...] Thanks for jogging my memory. I've released an updated version of resource-pool that drops the dependency on that package. http://hackage.haskell.org/package/resource-pool ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The Typeable class is changing
I hope that typeRepKey is no longer in the IO monad (for the simple reason to teach me that the key can change between session). This forced me to use unsafePerformIO to make a typeable boxed type of instances of Ord an instance of Ord (to put it in a Map). Or did I miss something and I can do better anyhow? e.g.: class (Ord s, Typeable s) = Selector s data GenSelector = forall s . Selector s = GS s instance Ord GenSelector where compare (GS a) (GS b) = if typeOf a == typeOf b then compare (fromJust (cast a)) b else compare (unsafePerformIO $ typeRepKey $ typeOf a) (unsafePerformIO $ typeRepKey $ typeOf b) Jürgen Nicklisch -- View this message in context: http://haskell.1045720.n5.nabble.com/The-Typeable-class-is-changing-tp4576031p4576350.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The Typeable class is changing
On Mon, Jul 11, 2011 at 1:22 PM, jutaro j...@arcor.de wrote: I hope that typeRepKey is no longer in the IO monad (for the simple reason to teach me that the key can change between session). If it's implementation dependent then I see no reason for it to be in IO (this was mentioned on another ML). On the other hand, something that changes run-to-run strikes me as good to keep in IO, otherwise I'd be too tempted to serialize save it for some purpose and get confused while a later read was corrupt. Cheers, Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fwd: The Typeable class is changing
What to do when the data has been defined in other package and provides no Typeable instance? 2011/7/11 Yitzchak Gale g...@sefer.org Simon Marlow has announced[1] on the Haskell Libraries list that the Typeable class is changing. The standard way to create a Typeable instance is just to derive it. If you do that, you will not be affected by this change. But it seems that many packages create Typeable instances by explicitly using mkTyCon. If your package does this, it will eventually break, after a deprecation period. Please respond to this thread if you own a package that will be affected by this change. Can someone who has quick access to the entire contents of Hackage please do a grep and find out exactly which packages on Hackage will be affected? Thanks. -Yitz [1] http://www.haskell.org/pipermail/libraries/2011-July/016546.html ___ 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] External system connections
12 July 2011 05:49, Michael Snoyman mich...@snoyman.com wrote: As for Bryan's resource-pool: currently I would strongly recommend *against* using it for any purpose. It is based on MonadCatchIO-transformers[2], which is a subtly broken package. In particular, when I tried using it for pool/persistent in the first place, I ended up with double-free bugs from SQLite. Do you have a reference explaining this brokenness? e.g. a mailing list message? I wasn't aware of this. Are the other MonadCatchIO-* packages also broken? Alistair ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: The Typeable class is changing
Alberto G. Corona agocor...@gmail.com wrote: What to do when the data has been defined in other package and provides no Typeable instance? You'd have to use standalone deriving, which I hope gets into Haskell 201X. module A where data A = A {-# LANGUAGE StandaloneDeriving, DeriveDataTypeable #-} module B where import A import Data.Typeable deriving instance Typeable A Cheers, Thomas 2011/7/11 Yitzchak Gale g...@sefer.org Simon Marlow has announced[1] on the Haskell Libraries list that the Typeable class is changing. The standard way to create a Typeable instance is just to derive it. If you do that, you will not be affected by this change. But it seems that many packages create Typeable instances by explicitly using mkTyCon. If your package does this, it will eventually break, after a deprecation period. Please respond to this thread if you own a package that will be affected by this change. Can someone who has quick access to the entire contents of Hackage please do a grep and find out exactly which packages on Hackage will be affected? Thanks. -Yitz [1] http://www.haskell.org/pipermail/libraries/2011-July/016546.html ___ 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] The Typeable class is changing
This will affect snap-core and heist, of the things I've provided Typeable instances for. In snap-core, deriving makes it use the internal module name, rather than the canonical location of the type. This causes issues with the Hint library, so it's worked around by using a manual instance of Typeable. Alternatively, heist involves a monad transformer. deriving Typeable fails for monad transformers, because it can't handle TyCons with arguments of kind other than *. So, this change will hit me for two different reasons, and sadly involve using CPP to control how things are compiled. Carl On Mon, Jul 11, 2011 at 11:18 AM, Yitzchak Gale g...@sefer.org wrote: Simon Marlow has announced[1] on the Haskell Libraries list that the Typeable class is changing. The standard way to create a Typeable instance is just to derive it. If you do that, you will not be affected by this change. But it seems that many packages create Typeable instances by explicitly using mkTyCon. If your package does this, it will eventually break, after a deprecation period. Please respond to this thread if you own a package that will be affected by this change. Can someone who has quick access to the entire contents of Hackage please do a grep and find out exactly which packages on Hackage will be affected? Thanks. -Yitz [1] http://www.haskell.org/pipermail/libraries/2011-July/016546.html ___ 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] The Typeable class is changing
On 7/11/11 11:18 AM, Yitzchak Gale wrote: The standard way to create a Typeable instance is just to derive it. If you do that, you will not be affected by this change. This is only the standard way if one is willing to sacrifice Haskell98 or Haskell2010 compatibility by using the non-standard DeriveDataTypeable extension. But it seems that many packages create Typeable instances by explicitly using mkTyCon. If your package does this, it will eventually break, after a deprecation period. I have done this in at least one of my packages (type-level-natural-number) because I wanted to keep my library compatible with Haskell2010 rather than relying on GHC-specific extensions. To be clear, I think that the new Typeable is an improvement and don't mind migrating my package to use it, I just get the sense after reading the linked exchange that those discussing this have just assumed that the standard way to use Typeable *should be* to use deriving Typeable and are missing what I suspect is a major reason why people avoid using it, which is to reduce dependence on GHC-specific extensions. Again, this not a complaint or an objection at all, I'm just sharing my own thoughts on the matter. :-) Cheers, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming
You guys might want to checkout the recent work on Euterpea at Yale CS. In particular: 1. Paul Hudak is writing a new book. http://plucky.cs.yale.edu/cs431/reading.htm 2. It uses FRP and arrows for sound synthesis. 3. It combines FRP signals with monadic (which recently gets re-written in arrows) GUI composition. 4. New novel techniques is being developed to handle I/O within arrows framework. The code can be obtained through darcs, details at http://plucky.cs.yale.edu/cs431/software_resources.htm Notably, the way it handles GUI is that the composition of widgets are static, but the signals flowing between them are dynamic. This closely follows Conal Elliott's Phooey approach, and greatly reduces the complexity of GUI programming. Disclaimer: I was an ex-student who worked on this project. Regards, Paul Liu On Thu, Jul 7, 2011 at 11:08 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Dear Haskellers, Can GUI programming be liberated from the IO monad? -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming
1. Paul Hudak is writing a new book. http://plucky.cs.yale.edu/cs431/reading.htm Wow... this is going to be my bedside reading. I haven't read the original Haskell School of Expression, did it use FRP back then? 2011/7/11 Paul Liu nine...@gmail.com You guys might want to checkout the recent work on Euterpea at Yale CS. In particular: 1. Paul Hudak is writing a new book. http://plucky.cs.yale.edu/cs431/reading.htm 2. It uses FRP and arrows for sound synthesis. 3. It combines FRP signals with monadic (which recently gets re-written in arrows) GUI composition. 4. New novel techniques is being developed to handle I/O within arrows framework. The code can be obtained through darcs, details at http://plucky.cs.yale.edu/cs431/software_resources.htm Notably, the way it handles GUI is that the composition of widgets are static, but the signals flowing between them are dynamic. This closely follows Conal Elliott's Phooey approach, and greatly reduces the complexity of GUI programming. Disclaimer: I was an ex-student who worked on this project. Regards, Paul Liu On Thu, Jul 7, 2011 at 11:08 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Dear Haskellers, Can GUI programming be liberated from the IO monad? -- Regards, Paul Liu ___ 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] External system connections
On Jul 11, 2011, at 10:48 PM, Alistair Bayley wrote: 12 July 2011 05:49, Michael Snoyman mich...@snoyman.com wrote: As for Bryan's resource-pool: currently I would strongly recommend *against* using it for any purpose. It is based on MonadCatchIO-transformers[2], which is a subtly broken package. In particular, when I tried using it for pool/persistent in the first place, I ended up with double-free bugs from SQLite. Do you have a reference explaining this brokenness? e.g. a mailing list message? I wasn't aware of this. Are the other MonadCatchIO-* packages also broken? http://www.haskell.org/pipermail/haskell-cafe/2010-October/084890.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming
The original SOE had some FAL (functional animation) stuff, but I don't think it used specifically the word FRP. Certainly the concept of a first-class signal (behavior and event) was present. Regards, Paul Liu On Mon, Jul 11, 2011 at 3:22 PM, Yves Parès limestr...@gmail.com wrote: 1. Paul Hudak is writing a new book. http://plucky.cs.yale.edu/cs431/reading.htm Wow... this is going to be my bedside reading. I haven't read the original Haskell School of Expression, did it use FRP back then? 2011/7/11 Paul Liu nine...@gmail.com You guys might want to checkout the recent work on Euterpea at Yale CS. In particular: 1. Paul Hudak is writing a new book. http://plucky.cs.yale.edu/cs431/reading.htm 2. It uses FRP and arrows for sound synthesis. 3. It combines FRP signals with monadic (which recently gets re-written in arrows) GUI composition. 4. New novel techniques is being developed to handle I/O within arrows framework. The code can be obtained through darcs, details at http://plucky.cs.yale.edu/cs431/software_resources.htm Notably, the way it handles GUI is that the composition of widgets are static, but the signals flowing between them are dynamic. This closely follows Conal Elliott's Phooey approach, and greatly reduces the complexity of GUI programming. Disclaimer: I was an ex-student who worked on this project. Regards, Paul Liu On Thu, Jul 7, 2011 at 11:08 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Dear Haskellers, Can GUI programming be liberated from the IO monad? -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The Typeable class is changing
At Mon, 11 Jul 2011 21:18:30 +0300, Yitzchak Gale wrote: Please respond to this thread if you own a package that will be affected by this change. iterIO uses mkTyCon for the simple reason that ((Typeable t, Typeable m) = Iter t m) is Typeable1 and there is no automatic way of deriving Typeable1. David ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe