[Haskell-cafe] ghc-mtl and ghc-7.2.1
Hello. In order to compile ghc-mtl-1.0.1.0 (the latest released version) with ghc-7.2.1, I would apply the attached patch, which removes any references to WarnLogMonad. ghc-7.2.1 does not have the monad WarnLogMonad anymore. As I do not know the details of the GHC api, I am not sure if this is enough to use ghc-mtl with ghc-7.2.1. I want ghc-mtl in order do build lambdabot. Any thoughts? Romildo diff -ur ghc-mtl-1.0.1.0.orig/Control/Monad/Ghc.hs ghc-mtl-1.0.1.0/Control/Monad/Ghc.hs --- ghc-mtl-1.0.1.0.orig/Control/Monad/Ghc.hs 2011-09-07 07:38:20.297885351 -0300 +++ ghc-mtl-1.0.1.0/Control/Monad/Ghc.hs2011-09-07 08:31:44.132815320 -0300 @@ -12,13 +12,15 @@ import Control.Monad.CatchIO import qualified GHC ( runGhc, runGhcT ) -import qualified HscTypes as GHC +-- import qualified HscTypes as GHC +import qualified GhcMonad as GHC import qualified MonadUtils as GHC import qualified Exception as GHC newtype Ghc a = Ghc (GHC.Ghc a) deriving (Functor, Monad, - GHC.WarnLogMonad, GHC.ExceptionMonad, GHC.MonadIO, GHC.GhcMonad) + -- GHC.WarnLogMonad, + GHC.ExceptionMonad, GHC.MonadIO, GHC.GhcMonad) instance MTL.MonadIO Ghc where liftIO = GHC.liftIO @@ -56,9 +58,9 @@ gblock = block gunblock = unblock -instance MTL.MonadIO m = GHC.WarnLogMonad (GhcT m) where -setWarnings = GhcT . GHC.setWarnings -getWarnings = GhcT GHC.getWarnings +-- instance MTL.MonadIO m = GHC.WarnLogMonad (GhcT m) where +-- setWarnings = GhcT . GHC.setWarnings +-- getWarnings = GhcT GHC.getWarnings instance (Functor m, MonadCatchIO m) = GHC.GhcMonad (GhcT m) where getSession = GhcT GHC.getSession ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] mapM is supralinear?
Travis Erdman traviserd...@yahoo.com wrote: The performance of mapM appears to be supralinear in the length of the list it is mapping on. Does it need to be this way? As a comparison, both mapM_ and map are linear in the length of the list. It needs to be this way in most monads. It's not a problem of mapM itself, but of its definition in the particular monad. In general it's a bad idea to use mapM over IO. For [] it will eat lots of memory quickly and by its mere definition there is nothing you can do about that. mapM_ is linear, because it can throw away the results, so no complicated accumulation occurs. map is usually linear, because used properly it will be optimized away leaving just a loop, which doesn't produce any data structures in memory and is just run element by element. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife = sex) http://ertes.de/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax?
Hi Erik, thanks a lot! fclabels is an amazing package! My code become much clearer. Greetings, Árpád On Wed, 2011-09-07 at 00:04 +0200, Erik Hesselink wrote: 2011/9/6 Poprádi Árpád popradi_ar...@freemail.hu: i have a record with a lot of items used in a state monad. data BigData = BigData { data1 :: X , data2 :: X -- and so on } updateData1 :: X - MonadicEnv() updateData1 d = do; env - get; put env {data1 = d} updateData2 :: X - MonadicEnv() updateData2 d = do; env - get; put env {data2 = d} But it's ugly. Always the same, only the record selector has another name. Is it possible to generalize it? You can use the fclabels package [1] for this. It makes record labels first class, and also provides functions to update parts of a record in the state monad [2]. You would be able to write something like: updateData1 = puts data1 d It has a function for modifcation as well, which is even uglier with regular record syntax. Erik [1] http://hackage.haskell.org/package/fclabels [2] http://hackage.haskell.org/packages/archive/fclabels/1.0.4/doc/html/Data-Label-PureM.html#v:puts ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc-mtl and ghc-7.2.1
Hi Romildo, you can try the darcs version of ghc-mtl [1], I don't know if that will be enough to build lambdabot, though Best, Daniel [1] http://darcsden.com/jcpetruzza/ghc-mtl On Sep 7, 2011, at 1:34 PM, José Romildo Malaquias wrote: Hello. In order to compile ghc-mtl-1.0.1.0 (the latest released version) with ghc-7.2.1, I would apply the attached patch, which removes any references to WarnLogMonad. ghc-7.2.1 does not have the monad WarnLogMonad anymore. As I do not know the details of the GHC api, I am not sure if this is enough to use ghc-mtl with ghc-7.2.1. I want ghc-mtl in order do build lambdabot. Any thoughts? Romildo ghc-mtl-1.0.1.0-gcc721.patch___ 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] Next European Hackathon
‘Ello! Any plans for the next European hackathon location that will presumably be in 6~ months? I need time to reap potential participants. Wonder if we could arrange an Italian hackathon? Verohac? Hm. :-) Maybe Utrecht? Hac6? Ciao! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: Is there any way to parametrize a value update using record syntax?
Hi David, thank You for your suggestions but the usage of fclabes is much better for me (otherwise it uses template haskell inside too). Some benefits: - It has a nice example for usage. - Not even a little wrapper is needed to make a get (or set) with a record field. You can use the field name directly for both direction (get and set). - It's prepared for usage in a state monad. - A record field is represented with a value (and a type) so you can easily compose it (one of the main problem with haskell's original record field syntax). Thanks, Árpád On Tue, 2011-09-06 at 14:55 -0700, David Barbour wrote: forgot to CC list. -- Forwarded message -- From: David Barbour dmbarb...@gmail.com Date: 2011/9/6 Subject: Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax? To: Poprádi Árpád popradi_ar...@freemail.hu 2011/9/6 Poprádi Árpád popradi_ar...@freemail.hu But it's ugly. Always the same, only the record selector has another name. Is it possible to generalize it? You can generalize using template haskell. I believe Oleg's HList already provides such mechanisms, so you don't need to do this yourself. If you're doing this a lot, try the HList package. (If not, just do the Also, I would say you've too tightly coupled your BigData to the MonadicEnv. I suggest you reduce it instead to: setX :: X - BigData - BigData setX x' bd = bd { dataX = x' } updX :: (X - X) - BigData - BigData updX fx bd = bd { dataX = fx (dataX bd) } Then in your state monad you can use: modify (setX x') gets dataX And use of 'updX' is much more composable. That aside, from personal experience, I'm usually okay just using: modify (\ s - s { dataX = x' }) in the few places I need it. ___ 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] Haskell Weekly News: Issue 198
Welcome to issue 198 the HWN, a newsletter covering developments in the Haskell community. This release covers the week of August 28 to September 3, 2011. Announcements Eric Y. Know released the 5th edition of the Parallel Haskell Digest. [1] http://goo.gl/Jqx01 New and Updated Projects * swapper (New - Roman Smrz) Provides a wrapper for functors, which allows their data to be automatically and transparently swapped to disk and loaded back when necessary. [2] http://goo.gl/CwojE * GA (New - Kenneth Hoste) Provides support for working with genetic algorithms in Haskell. [3] http://goo.gl/XjvFA * hledger[-web] (Update - Simon Michael) Bugfix update. [4] http://goo.gl/98ApM * bindings-DSL (Update - Mauricio CA) Provides a language to describe foreign interfaces on top of hsc2hs. [5] http://goo.gl/fFL4Y * hspec (Update - Trystan Spangler) This latest release includes a command line runner that can search through directory trees for specs and support for nested specs. [6] http://goo.gl/rVbF0 * EclipseFP (Update - JP Moresmau) New features and bugfixes. [7] http://goo.gl/dXS6t Quotes of the Week * dankna: I do [gui on osx] by writing a polyglot ObjC/Haskell program * maurer: I'd do it kmc style * hpc: your next challenge: write a definition of fix in java that fits in a twitter post * kmc: i leave for 3 seconds and you're all metaprogramming and shit * acowley: Haskellers are so abstract they can't even spell primitive * edwardk: i was happy that i had the 4th entry on google for a topic... but then i realized it was only for me, not for everyone that searches for it * kmc: oh, my suggestion was to hand off the fd's directly through a UNIX socket ... but that's probably silly ... i just like the fact that fd's can be passed through a unix socket * monochrom: linear types change the world! says Wadler. Record updates change the type! says Haskell. :) * gosu: Type parameters are covariant. This is not sound, and that does not matter. * Yitzchak Gale: I certainly wouldn't dream of dragging in type-level olegery, unsafe coercion, implicit parameters and other experimental extensions. Simplicity just works. Top Reddit Stories * 8 ways to report errors in Haskell revisited : Inside 233 Domain: blog.ezyang.com, Score: 51, Comments: 33 On Reddit: [8] http://goo.gl/RBcIL Original: [9] http://goo.gl/A2m2Z * Yesod 0.9 Released! A Massive Changelog explained. Domain: yesodweb.com, Score: 43, Comments: 6 On Reddit: [10] http://goo.gl/go7Zo Original: [11] http://goo.gl/dGoMa * EclipseFP 2.1.0 released, with Hoogle and HLint integration, and much more! Domain: jpmoresmau.blogspot.com, Score: 40, Comments: 42 On Reddit: [12] http://goo.gl/6E1QV Original: [13] http://goo.gl/mkx7g * And they say complexity has no philosophical implications Domain: scottaaronson.com, Score: 36, Comments: 9 On Reddit: [14] http://goo.gl/g97k3 Original: [15] http://goo.gl/9OGU7 * data Maybe -- harmful? Domain: blog.dbpatterson.com, Score: 29, Comments: 26 On Reddit: [16] http://goo.gl/fd2QC Original: [17] http://goo.gl/x4ibO * haskell-TLS framework progress report Domain: tab.snarc.org, Score: 29, Comments: 14 On Reddit: [18] http://goo.gl/Mdc8x Original: [19] http://goo.gl/UpyZ6 * I made a simple image upload site using haskell, sqlite3 and lighttpd. Check it out. Domain: self.haskell, Score: 27, Comments: 15 On Reddit: [20] http://goo.gl/vuF8E Original: [21] http://goo.gl/vuF8E * Manuel Chakravarty on Data Parallel Haskell Domain: vimeo.com, Score: 26, Comments: 2 On Reddit: [22] http://goo.gl/CLXJU Original: [23] http://goo.gl/jCf9w * Functional Programming Day : Oct 14th, Cambridge, UK SPJ D Syme - early book. bef. Aug 31st Domain: fpday.net, Score: 18, Comments: 11 On Reddit: [24] http://goo.gl/wbIWr Original: [25] http://goo.gl/8OPgK * How does AwesomePrelude transform non-strict code to efficient strict code? Domain: self.haskell, Score: 18, Comments: 12 On Reddit: [26] http://goo.gl/VgIQt Original: [27] http://goo.gl/VgIQt * Composable MVCs (or UIs), a google talk by Conal Elliot Domain: youtube.com, Score: 18, Comments: 14 On Reddit: [28] http://goo.gl/9ekmO Original: [29] http://goo.gl/GDEkN Top StackOverflow Questions * Good examples of Not a Functor/Functor/Applicative/Monad? votes: 17, answers: 3 Read on SO: [30] http://goo.gl/F2q5y * Haskell: What monad did I just reinvent? votes: 17, answers: 4 Read on SO: [31] http://goo.gl/HCko4 * Why is Scalas type inference not as powerful as Haskells? votes: 17, answers: 4 Read on SO: [32] http://goo.gl/gvCF1 * Hard to understand Haskell