Re: [Haskell-cafe] plugins and cabal build
Ivan Lazar Miljenovic writes: > On 26 April 2011 04:57, Michael Snoyman wrote: >> Hi all, >> >> I'm experimenting with using the plugins package for yesod devel >> server. The basic approach is to use cabal for building the object >> files, and then load them with plugins. I can get everything to work >> when I compile with "ghc --make", but I believe name mangling is >> getting in the way with the "cabal build" route. Can someone give some >> guidance on how to properly mangle the function names so that plugins >> can load them? > > I'm not sure if he reads this list, but Andy Stewart might know (and > I've CC'd him to this). Hi Ivan, sorry for late, too busy on Linux job. Yes, i have got hot-swap code work for Manatee (http://hackage.haskell.org/package/manatee) I used to use plugins, but i found it's buggy. So i use GHC-API wrote my own code at: https://patch-tag.com/r/AndyStewart/manatee-core/snapshot/current/content/pretty/Manatee/Core/Dynload.hs Michael, from your need, you just need read function `dynload`, other functions is write for Manatee framework. Let me explain function `dynload`: dynload :: (String, String, [(String, HValue -> IO ())]) -> IO () dynload (filepath, moduleName, loadList) = ... First argument is FilePath that contain module. Second argument is moduleName you need scan. Third argument is tuple list that contain symbol you need load and callback function for symbol's HValue. Once function `dynload` find symbol in target module, it will use below code dynamic load new value: (do hValue <- compileExpr (moduleName ++ "." ++ symbolName) liftIO $ loadFun hValue) function `compileExpr` will get the HValue of symbol, then use loadFun update HVaule in running program. The key is `HValue -> IO ()`, you need build TVar/IORef in your running program, once you got new HValue, you should write writeTVar/writeIORef in function `HValue -> IO ()` to update the value of TVar/IORef, then you can dynamic loading new value and don't need reboot. I have draw some picture to explain above framework: http://www.flickr.com/photos/48809572@N02/5304662424/in/photostream/lightbox/ Michael, hope above will help you, good luck! :) -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Install GTK on Windows
Daniel Díaz writes: > I have installed successfully the gtk package on Windows. > > GTK version: 2.16 > gtk package version: 0.12.0 > Haskell Platform version: 2010.2.0.0 > > I have detailed my steps (very similar to Mark Shroyer steps) here: > > http://deltadiaz.blogspot.com/2011/03/on-windows-how-to-install-gtk.html > > It seems that my error comes from an space in the path of gtk, and later, > from my version of the > Haskell Platform (cabal version, I guess). > > In brief: > 1) Install Haskell Platform, version 2010.2.0.0. > 2) Download and unpack gtk all-in-one bundle, version 2.16. Path without > spaces. > 3) Add gtk/bin and mingw/bin to the PATH environment variable. > 4) Install gtk2hs-buildtools. > 5) Install gtk. > > And it works! Great! :) -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Gtk2hs multiple column TreeView with ListStore issue
Andy Stewart writes: > Hi Кирилл, > > Here have a simplest code at > http://code.haskell.org/gtk2hs/gtk/demo/treelist/ListDemo.hs > > Cheers, > > -- Andy > > PS: > > All gtk2hs user, it's always best choose to read source code of demo > when you don't know how to fix some problem. > > Demo has include in Cabal package. > Example, we have build demo sub-directory in package gtk-0.12.0.tar.gz > Otherwise package, such as Cairo and Pango is same. Others package, damn english helper. :) -- Andy > > Of course, ask in gtk2hs-user mailing-list > (gtk2hs-us...@lists.sourceforge.net) are welcome! :) > > Кирилл Березин writes: > >> I cannot force GTK to render data in TreeView with ListStore model with >> multiple columns through >> Haskell. I have the following code >> >> addTextColumn view name = >> >> do >> >> col <- treeViewColumnNew >> >> rend <- cellRendererTextNew >> >> treeViewColumnSetTitle col name >> treeViewColumnPackStart col rend True >> treeViewColumnSetExpand col True >> treeViewAppendColumn view col >> >> prepareTreeView view = >> >> do >> >> addTextColumn view "column1" >> >> addTextColumn view "column2" >> >> --adding data here >> >> Then I try to add some data, and there are problems. I tried these: >> >> --variant 1 (data TRow = TRow {one::String, two::String} >> >> model <- listStoreNew ([] :: [TRow]) >> >> listStoreAppend model $ TRow { one = "Foo", two = "Boo" } >> >> treeViewSetModel view model >> >> --variant 2 >> >> model <- listStoreNew ([] :: [[String]]) >> >> listStoreAppend model ["foo","boo"] >> >> treeViewSetModel view model >> >> --variant 3 >> >> model <- listStoreNew ([] :: [(String, String)]) >> >> listStoreAppend model ("foo", "boo") >> >> treeViewSetModel view model >> >> But in all cases I see the table with column header and one blank row >> inserted. Any help will be >> appreciated. >> >> ___ >> 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] Gtk2hs multiple column TreeView with ListStore issue
Hi Кирилл, Here have a simplest code at http://code.haskell.org/gtk2hs/gtk/demo/treelist/ListDemo.hs Cheers, -- Andy PS: All gtk2hs user, it's always best choose to read source code of demo when you don't know how to fix some problem. Demo has include in Cabal package. Example, we have build demo sub-directory in package gtk-0.12.0.tar.gz Otherwise package, such as Cairo and Pango is same. Of course, ask in gtk2hs-user mailing-list (gtk2hs-us...@lists.sourceforge.net) are welcome! :) Кирилл Березин writes: > I cannot force GTK to render data in TreeView with ListStore model with > multiple columns through > Haskell. I have the following code > > addTextColumn view name = > > do > > col <- treeViewColumnNew > > rend <- cellRendererTextNew > > treeViewColumnSetTitle col name > treeViewColumnPackStart col rend True > treeViewColumnSetExpand col True > treeViewAppendColumn view col > > prepareTreeView view = > > do > > addTextColumn view "column1" > > addTextColumn view "column2" > > --adding data here > > Then I try to add some data, and there are problems. I tried these: > > --variant 1 (data TRow = TRow {one::String, two::String} > > model <- listStoreNew ([] :: [TRow]) > > listStoreAppend model $ TRow { one = "Foo", two = "Boo" } > > treeViewSetModel view model > > --variant 2 > > model <- listStoreNew ([] :: [[String]]) > > listStoreAppend model ["foo","boo"] > > treeViewSetModel view model > > --variant 3 > > model <- listStoreNew ([] :: [(String, String)]) > > listStoreAppend model ("foo", "boo") > > treeViewSetModel view model > > But in all cases I see the table with column header and one blank row > inserted. Any help will be > appreciated. > > ___ > 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] How large is the Haskell community ?
> On Sat, Feb 12, 2011 at 6:57 PM, Jan Christiansen > wrote: > > On 12.02.2011, at 21:18, Aaron Gray wrote: > > I was wondering if anyone had an idea or estimate as to how large the > Haskell community is ? > > All the answers made me wonder what the criterion is to be a member of > the Haskell > community. Are you a member if you downloaded > ghc, if you have (at least once) defined a Monad instance, if you have > written a hackage > package, if you have contributed to the > Monad.Reader, if you have a github account with at least one Haskell > project, if you read at > least one of the haskell mailing > lists, if you contribute to a haskell mailing list (perhaps on a regular > basis), if you post on > reddit, if you answer/ask > questions on stackoverflow, if you have written at least 1 lines of > code in Haskell, Manatee in developing, 26050 lines ... The real world program that written by Haskell. http://goo.gl/MkVw http://www.youtube.com/watch?v=weS6zys3U8k http://www.youtube.com/watch?v=A3DgKDVkyeM I do not care how large haskell community now, I only know ours efforts make haskell community become more powerful! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Install GTK on Windows
Hi Daniel, Gtk2hs site is down by move server, sadly. The document on http://www.haskell.org/haskellwiki/Gtk2Hs is wrong. http://markshroyer.com/2010/10/gtk2hs-on-windows/ is right. From your error, you missing C libraries that gtk2hs need, or you have install GTK+ C library, but gtk2hs can't find those libraries somehow (such as wrong configure ...) The right way is : 1) Install GTK+ all-in-one bundle (Include C library) 2) Very import, add GTK+ C library and Cabal bin path add in environment variable PATH 3) Then do "cabal update && cabal install gtk2hs-buildtools && cabal install gtk" I'm not Windows guy, but almost like above. I will find time re-build gtk2hs site and provide Windows Installer (But i can't promise when, i'm so busy) Hope above will help you. :) -- Andy Daniel Díaz writes: > Hi, cafe, > > I know this has been treated many times, but I've tried install GTK so > hard without any success that I decided to ask for help. > > Firstly, I followed the instructions listed in HaskellWiki [1]. No results. > > Then, I followed the instruction from the Mark Shroyer blog [2]. No results. > > I did some mixing of the two guides, too, but my error was always the same: > > Configuring cairo-0.12.0... > [...] > setup.exe: Missing dependencies on foreign libraries: > * Missing C libraries: z, cairo > > Configuring glib-0.12.0... > [...] > setup.exe: Missing dependencies on foreign libraries: > * Missing C libraries: gobject-2.0, gthread-2.0, glib-2.0, intl > > I've searched for these libraries, and, with --extra-include-dirs=, I've > included them. But the same error was thrown. > > I'm sure I'm doing something wrong or, perhaps, I'm missing something. > > Any help is welcomed! > > Thanks in advance, > Daniel Díaz > > References: > > [1] http://www.haskell.org/haskellwiki/Gtk2Hs > [2] http://markshroyer.com/2010/10/gtk2hs-on-windows/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] plugins and internal error: stg_ap_v_ret
Michael Snoyman writes: > Thanks for the link Andy, this definitely looks like the right I will > ultimately need to take. Good, here is framework link to help you understand Dynload.hs http://www.flickr.com/photos/48809572@N02/5304662424/sizes/l/ Manatee is huge, but Dynload.hs is pretty simple, you can copy Dynload.hs to your project for your need, the code under GPL-3. Cheers, -- Andy > I just found out that plugins does not > install very well on Windows, which is something I need to provide > good support for with wai-handler-devel. > > Michael > > On Tue, Feb 1, 2011 at 1:15 PM, Andy Stewart > wrote: >> Hi Michael, >> >> I have write some dynamic-loading code for my Manatee project >> (http://hackage.haskell.org/package/manatee) >> >> Dynload.hs use GHC API, if you interested it, you can read source code: >> >> > https://patch-tag.com/r/AndyStewart/manatee-core/snapshot/current/content/pretty/Manatee/Core/Dynload.hs >> >> Cheers, >> >> -- Andy >> >> Michael Snoyman writes: >> >>> Hi Andy, >>> >>> plugins *is* working in general for me for some trivial test cases. >>> It's specifically this use case with WAI that's causing trouble, which >>> implies to me I'm misusing the API somehow. >>> >>> Michael >>> >>> On Tue, Feb 1, 2011 at 4:22 AM, Andy Stewart >>> wrote: >>>> Hi Michael, >>>> >>>> plugins use it's own function instead GHC API, so it's easy to break >>>> with new version GHC. >>>> >>>> -- Andy >>>> >>>> Michael Snoyman >>>> writes: >>>> >>>>> Hi all, >>>>> >>>>> I'm trying to convert wai-handler-devel to use plugins instead of >>>>> hint, but cannot even get some basic usages to work properly. I've put >>>>> together a minimal example that loads a WAI application from a >>>>> separate file and runs it, but this immediately causes the program to >>>>> crash saying: >>>>> >>>>> loader: internal error: stg_ap_v_ret >>>>> (GHC version 6.12.3 for i386_unknown_linux) >>>>> Please report this as a GHC bug: >>>>> http://www.haskell.org/ghc/reportabug >>>>> >>>>> Is this an actual bug in GHC, or am I misusing the plugins package? >>>>> >>>>> The two source files: >>>>> >>>>> MyModule.hs >>>>> {-# LANGUAGE OverloadedStrings #-} >>>>> module MyModule where >>>>> >>>>> import Network.Wai >>>>> import Data.ByteString.Lazy.Char8 () >>>>> >>>>> myapp _ = responseLBS status200 [("Content-Type", "text/plain")] "myapp" >>>>> >>>>> loader.hs >>>>> import System.Plugins.Make >>>>> import System.Plugins.Load >>>>> import Network.Wai.Handler.Warp (run) >>>>> >>>>> main :: IO () >>>>> main = do >>>>> MakeSuccess _ obj <- makeAll "MyModule.hs" [] >>>>> LoadSuccess _ app <- load_ obj [] "myapp" >>>>> run 3000 app >>>>> >>>>> Thanks, >>>>> Michael >>>> >>>> >>>> ___ >>>> 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] plugins and internal error: stg_ap_v_ret
Hi Michael, I have write some dynamic-loading code for my Manatee project (http://hackage.haskell.org/package/manatee) Dynload.hs use GHC API, if you interested it, you can read source code: https://patch-tag.com/r/AndyStewart/manatee-core/snapshot/current/content/pretty/Manatee/Core/Dynload.hs Cheers, -- Andy Michael Snoyman writes: > Hi Andy, > > plugins *is* working in general for me for some trivial test cases. > It's specifically this use case with WAI that's causing trouble, which > implies to me I'm misusing the API somehow. > > Michael > > On Tue, Feb 1, 2011 at 4:22 AM, Andy Stewart > wrote: >> Hi Michael, >> >> plugins use it's own function instead GHC API, so it's easy to break >> with new version GHC. >> >> -- Andy >> >> Michael Snoyman >> writes: >> >>> Hi all, >>> >>> I'm trying to convert wai-handler-devel to use plugins instead of >>> hint, but cannot even get some basic usages to work properly. I've put >>> together a minimal example that loads a WAI application from a >>> separate file and runs it, but this immediately causes the program to >>> crash saying: >>> >>> loader: internal error: stg_ap_v_ret >>> (GHC version 6.12.3 for i386_unknown_linux) >>> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug >>> >>> Is this an actual bug in GHC, or am I misusing the plugins package? >>> >>> The two source files: >>> >>> MyModule.hs >>> {-# LANGUAGE OverloadedStrings #-} >>> module MyModule where >>> >>> import Network.Wai >>> import Data.ByteString.Lazy.Char8 () >>> >>> myapp _ = responseLBS status200 [("Content-Type", "text/plain")] "myapp" >>> >>> loader.hs >>> import System.Plugins.Make >>> import System.Plugins.Load >>> import Network.Wai.Handler.Warp (run) >>> >>> main :: IO () >>> main = do >>> MakeSuccess _ obj <- makeAll "MyModule.hs" [] >>> LoadSuccess _ app <- load_ obj [] "myapp" >>> run 3000 app >>> >>> Thanks, >>> Michael >> >> >> ___ >> 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] plugins and internal error: stg_ap_v_ret
Hi Michael, plugins use it's own function instead GHC API, so it's easy to break with new version GHC. -- Andy Michael Snoyman writes: > Hi all, > > I'm trying to convert wai-handler-devel to use plugins instead of > hint, but cannot even get some basic usages to work properly. I've put > together a minimal example that loads a WAI application from a > separate file and runs it, but this immediately causes the program to > crash saying: > > loader: internal error: stg_ap_v_ret > (GHC version 6.12.3 for i386_unknown_linux) > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > Is this an actual bug in GHC, or am I misusing the plugins package? > > The two source files: > > MyModule.hs > {-# LANGUAGE OverloadedStrings #-} > module MyModule where > > import Network.Wai > import Data.ByteString.Lazy.Char8 () > > myapp _ = responseLBS status200 [("Content-Type", "text/plain")] "myapp" > > loader.hs > import System.Plugins.Make > import System.Plugins.Load > import Network.Wai.Handler.Warp (run) > > main :: IO () > main = do > MakeSuccess _ obj <- makeAll "MyModule.hs" [] > LoadSuccess _ app <- load_ obj [] "myapp" > run 3000 app > > Thanks, > Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Manatee-0.1.8 release!
Hi all, Manatee-0.1.8 release! New features in manatee-0.1.8: * Manatee now can works in XMonad * Use Ping/Pong solution fix immortal render process when daemon process killed by user forcely. * Move message/status update code to extension space. * File manager can monitor file change now * Add new package: manatee-template, template code to help create manatee application. * Add some utils functions in manatee-core Session manager will bring in 0.1.9, that's mean, Manatee will restore your layout before exit. IDE framework will bring in 0.2.0, support Haskell first, and will support C and Java in the future. Enjoy! :) Any patch and suggestion are welcome! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Join Manatee Team!
Hi, From your error, you need re-install package `derive` and `regex-tdfa`, then re-install manatee again. BTW, follow the step i wrote at http://hackage.haskell.org/package/manatee Please let me know if you have any problem with Manatee. Thanks, -- Andy aditya siram writes: > I do have some errors in ghc-pkg but they don't seem to relate to > manatee. I am using ghc-6.12.3 > >> ghc-pkg check > There are problems in package happstack-util-0.5.0.2: > dependency "strict-concurrency-0.2.3-27185142ee20a352ac984eb1a7ba31ea" > doesn't exist > There are problems in package hlint-1.8.3: > dependency "uniplate-1.5.1-43c5344609d31cc668c4c59beef1c515" doesn't exist > There are problems in package yi-0.6.2.2: > dependency "derive-2.3.0.2-c8dea0face9fceb5dab2c976a7cef69b" doesn't exist > dependency "regex-tdfa-1.1.6-49fe08d7468d9de43cefb17ac16ff6bf" doesn't exist > dependency "uniplate-1.5.1-43c5344609d31cc668c4c59beef1c515" doesn't exist > There are problems in package filestore-0.3.4.1: > dependency "datetime-0.2-bcd61567f8553949b0cce107933fa526" doesn't exist > There are problems in package gitit-0.7.3.6: > dependency "datetime-0.2-bcd61567f8553949b0cce107933fa526" doesn't exist > > The following packages are broken, either because they have a problem > listed above, or because they depend on a broken package. > happstack-util-0.5.0.2 > hlint-1.8.3 > yi-0.6.2.2 > filestore-0.3.4.1 > gitit-0.7.3.6 > happstack-0.5.0.3 > happstack-server-0.5.0.2 > happstack-ixset-0.5.0.3 > happstack-data-0.5.0.2 > happstack-state-0.5.0.4 > >> ghc --version > The Glorious Glasgow Haskell Compilation System, version 6.12.3 > > -deech > > On Mon, Jan 10, 2011 at 8:40 PM, Andy Stewart > wrote: >> Hi aditya, >> >> What's the result of command "ghc-pkg check"? >> And which GHC version do you use? >> >> Manatee can't work with ghc-7.0.1 (ghc-7.0.1 have bug) >> >> Thanks, >> >> -- Andy >> >> aditya siram writes: >> >>> Thanks for the great software! I tried to install manatee from Hackage >>> and got the following error: >>> Configuring manatee-core-0.0.7... >>> Warning: This package indirectly depends on multiple versions of the same >>> package. This is highly likely to cause a compile failure. >>> package uniplate-1.5.1 requires containers-0.3.0.0 >>> package template-haskell-2.4.0.1 requires containers-0.3.0.0 >>> package regex-tdfa-1.1.6 requires containers-0.3.0.0 >>> package regex-base-0.93.2 requires containers-0.3.0.0 >>> package pango-0.12.0 requires containers-0.3.0.0 >>> package manatee-core-0.0.7 requires containers-0.3.0.0 >>> package hpc-0.5.0.5 requires containers-0.3.0.0 >>> package gtksourceview2-0.12.2 requires containers-0.3.0.0 >>> package gtk-serialized-event-0.12.0 requires containers-0.3.0.0 >>> package gtk-0.12.0 requires containers-0.3.0.0 >>> package glib-0.12.0 requires containers-0.3.0.0 >>> package gio-0.12.0 requires containers-0.3.0.0 >>> package ghc-binary-0.5.0.2 requires containers-0.3.0.0 >>> package ghc-6.12.3 requires containers-0.3.0.0 >>> package gconf-0.12.0 requires containers-0.3.0.0 >>> package derive-2.4.1 requires containers-0.3.0.0 >>> package deepseq-1.1.0.2 requires containers-0.3.0.0 >>> package dbus-core-0.8.5.3 requires containers-0.3.0.0 >>> package dbus-client-0.3 requires containers-0.3.0.0 >>> package dataenc-0.13.0.4 requires containers-0.3.0.0 >>> package binary-0.5.0.2 requires containers-0.3.0.0 >>> package Cabal-1.8.0.6 requires containers-0.3.0.0 >>> package template-haskell-2.4.0.1 requires containers-0.4.0.0 >>> package regex-base-0.93.2 requires mtl-1.1.0.2 >>> package uniplate-1.5.1 requires mtl-2.0.1.0 >>> package regex-tdfa-1.1.6 requires mtl-2.0.1.0 >>> package pango-0.12.0 requires mtl-2.0.1.0 >>> package manatee-core-0.0.7 requires mtl-2.0.1.0 >>> package gtksourceview2-0.12.2 requires mtl-2.0.1.0 >>> package gtk-serialized-event-0.12.0 requires mtl-2.0.1.0 >>> package gtk-0.12.0 requires mtl-2.0.1.0 >>> package gio-0.12.0 requires mtl-2.0.1.0 >>> package gconf-0.12.0 requires mtl-2.0.1.0 >>> package cairo-0.12.0 requires mtl-2.0.1.0 >>> package QuickCheck-2.1.1.1 requires mtl-2.0.1.0 >>> package ghc-6.12.3 requires template-haskell-2.4.0.1 >>> package manatee-core-0.0.7 requires template-haskell-2.4.0.1 >>> package derive-2.4.1 requires
Re: [Haskell-cafe] Join Manatee Team!
Hi aditya, What's the result of command "ghc-pkg check"? And which GHC version do you use? Manatee can't work with ghc-7.0.1 (ghc-7.0.1 have bug) Thanks, -- Andy aditya siram writes: > Thanks for the great software! I tried to install manatee from Hackage > and got the following error: > Configuring manatee-core-0.0.7... > Warning: This package indirectly depends on multiple versions of the same > package. This is highly likely to cause a compile failure. > package uniplate-1.5.1 requires containers-0.3.0.0 > package template-haskell-2.4.0.1 requires containers-0.3.0.0 > package regex-tdfa-1.1.6 requires containers-0.3.0.0 > package regex-base-0.93.2 requires containers-0.3.0.0 > package pango-0.12.0 requires containers-0.3.0.0 > package manatee-core-0.0.7 requires containers-0.3.0.0 > package hpc-0.5.0.5 requires containers-0.3.0.0 > package gtksourceview2-0.12.2 requires containers-0.3.0.0 > package gtk-serialized-event-0.12.0 requires containers-0.3.0.0 > package gtk-0.12.0 requires containers-0.3.0.0 > package glib-0.12.0 requires containers-0.3.0.0 > package gio-0.12.0 requires containers-0.3.0.0 > package ghc-binary-0.5.0.2 requires containers-0.3.0.0 > package ghc-6.12.3 requires containers-0.3.0.0 > package gconf-0.12.0 requires containers-0.3.0.0 > package derive-2.4.1 requires containers-0.3.0.0 > package deepseq-1.1.0.2 requires containers-0.3.0.0 > package dbus-core-0.8.5.3 requires containers-0.3.0.0 > package dbus-client-0.3 requires containers-0.3.0.0 > package dataenc-0.13.0.4 requires containers-0.3.0.0 > package binary-0.5.0.2 requires containers-0.3.0.0 > package Cabal-1.8.0.6 requires containers-0.3.0.0 > package template-haskell-2.4.0.1 requires containers-0.4.0.0 > package regex-base-0.93.2 requires mtl-1.1.0.2 > package uniplate-1.5.1 requires mtl-2.0.1.0 > package regex-tdfa-1.1.6 requires mtl-2.0.1.0 > package pango-0.12.0 requires mtl-2.0.1.0 > package manatee-core-0.0.7 requires mtl-2.0.1.0 > package gtksourceview2-0.12.2 requires mtl-2.0.1.0 > package gtk-serialized-event-0.12.0 requires mtl-2.0.1.0 > package gtk-0.12.0 requires mtl-2.0.1.0 > package gio-0.12.0 requires mtl-2.0.1.0 > package gconf-0.12.0 requires mtl-2.0.1.0 > package cairo-0.12.0 requires mtl-2.0.1.0 > package QuickCheck-2.1.1.1 requires mtl-2.0.1.0 > package ghc-6.12.3 requires template-haskell-2.4.0.1 > package manatee-core-0.0.7 requires template-haskell-2.4.0.1 > package derive-2.4.1 requires template-haskell-2.4.0.1 > Preprocessing library manatee-core-0.0.7... > Building manatee-core-0.0.7... > : cannot satisfy -package-id > derive-2.4.1-4ef8b6126acc8c74f66079e125ebc9fd: > derive-2.4.1-4ef8b6126acc8c74f66079e125ebc9fd is unusable due to > missing or recursive dependencies: > template-haskell-2.4.0.1-e67380b2b1931beefbe73530e50ff045 > (use -v for more information) > cabal: Error: some packages failed to install: > manatee-0.1.7 depends on manatee-core-0.0.7 which failed to install. > manatee-core-0.0.7 failed during the building phase. The exception was: > exit: ExitFailure 1 > > -deech > > On Mon, Jan 10, 2011 at 7:45 PM, Andy Stewart > wrote: >> Hi all, >> >> I'm Andy, the author of Manatee >> ( http://haskell.org/haskellwiki/Manatee ). >> >> You can watch video >> http://www.youtube.com/watch?v=weS6zys3U8k >> (or http://www.youtube.com/watch?v=A3DgKDVkyeM ) >> to understand "What is it?" . :) >> >> Manatee is Haskell integrated environment written in Haskell. >> >> The goal of the Manatee project is provide a fast, safe and flexible >> integrated environment for haskell hacking. >> >> Some cool feature in Manatee: >> >> * It can dynamic update Haskell extension code in runtime, like elisp >> for Emacs. >> >> * It protected every application in sandbox, so it minimum your >> losses once unexpected exception throw. >> >> * It's multi-thread design, it's won't freeze your operation in anytime. >> >> * It provide handy window manage, you can mix any application >> together fastly. >> >> * You can use keyboard control everything you want, and same >> experience in all applications. :) >> >> * You can use it develop any application you want, not just text >> toy. :) >> >> ... etc. >> >> I'm looking for new developer join Manatee Team, I believe you guys can >> develop cooler application than me. :) >> >> If you interested Manatee, welcome to join >> >> manatee-u...@googlegroups.com >> (or https://groups.google.com/forum/#!forum/manatee-user ) >> >> Thanks, >> >> -- Andy >> >> PS. I'm working on session manager and IDE feature... >> >> >> ___ >> 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] Join Manatee Team!
Hi all, I'm Andy, the author of Manatee ( http://haskell.org/haskellwiki/Manatee ). You can watch video http://www.youtube.com/watch?v=weS6zys3U8k (or http://www.youtube.com/watch?v=A3DgKDVkyeM ) to understand "What is it?" . :) Manatee is Haskell integrated environment written in Haskell. The goal of the Manatee project is provide a fast, safe and flexible integrated environment for haskell hacking. Some cool feature in Manatee: * It can dynamic update Haskell extension code in runtime, like elisp for Emacs. * It protected every application in sandbox, so it minimum your losses once unexpected exception throw. * It's multi-thread design, it's won't freeze your operation in anytime. * It provide handy window manage, you can mix any application together fastly. * You can use keyboard control everything you want, and same experience in all applications. :) * You can use it develop any application you want, not just text toy. :) ... etc. I'm looking for new developer join Manatee Team, I believe you guys can develop cooler application than me. :) If you interested Manatee, welcome to join manatee-u...@googlegroups.com (or https://groups.google.com/forum/#!forum/manatee-user ) Thanks, -- Andy PS. I'm working on session manager and IDE feature... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to write Manatee application?
Hi all, How to write Manatee extension? Now have answer: Please look http://www.flickr.com/photos/48809...@n02/5031811365/lightbox/ to understand framework before continue. Template code at http://hackage.haskell.org/package/manatee-template First, i explain Manatee package hierarchy: manatee-core contain DBus protocol detail and toolkit use in other manatee packages. manatee-anything is multi-task search interface for user input. manatee contain daemon process, Daemon process is root process to manage other manatee processes: such as render application process' graphics for sandbox protected, window manage ... etc. Daemon process just do manage job and don't running any special application code in it. Other manatee-* package, such as manatee-editor, manatee-browser...etc running in it's own process, you can write any code to implement your application, just need follow some interface: class Typeable a => PageBuffer a where -- Get buffer name. pageBufferGetName :: a -> IO String -- Set buffer name. pageBufferSetName :: a -> String -> IO () -- DBus client to handle DBus signal pageBufferClient:: a -> Client -- How to create view with buffer for MVC design. pageBufferCreateView:: a -> PagePlugId -> IO PageViewWrap -- Page buffer mode. pageBufferMode :: a -> PageMode -- Get package name to update user's configure. pageBufferPackageName :: a -> IO String class Typeable a => PageView a where -- Buffer for view. pageViewBuffer :: a -> PageBufferWrap -- GtkPlug id to send DBus signal to other process. pageViewPlugId :: a -> TVar PagePlugId -- How to handle key action from daemon process. pageViewHandleKeyAction :: a -> Text -> SerializedEvent -> IO () -- How to do when manatee framework focus on current application. pageViewFocus :: a -> IO () -- Scrolled window to contain application widget. pageViewScrolledWindow :: a -> ScrolledWindow -- How to handle cut action, can ignore. pageViewCut :: a -> IO Bool -- How to handle copy action, can ignore. pageViewCopy:: a -> IO Bool -- How to handle paste action, can ignore. pageViewPaste :: a -> IO Bool -- How to scroll top postion, can ignore. pageViewScrollToTop :: a -> IO () -- How to scroll bottom postion, can ignore. pageViewScrollToBottom :: a -> IO () -- How to scroll vertical page, can ignore. pageViewScrollVerticalPage :: Bool -> a -> IO () -- How to scroll vertical step, can ignore. pageViewScrollVerticalStep :: Bool -> a -> IO () -- How to scroll to left side, can ignore. pageViewScrollToLeft:: a -> IO () -- How to scroll to right side, can ignore. pageViewScrollToRight :: a -> IO () -- How to scroll horizontal page, can ignore. pageViewScrollHorizontalPage:: Bool -> a -> IO () -- How to scroll horizontal step, can ignore. pageViewScrollHorizontalStep:: Bool -> a -> IO () If you have any question, feel free to ask me (lazycat.mana...@gmail.com) -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Manatee-0.1.6 release!
Hi all, Manatee-0.1.6 release, sorry for late, I was tired of the many trivial this month. http://www.youtube.com/watch?v=weS6zys3U8k hackage.haskell.org/package/manatee New version Manatee support customize and hot-swap, like elisp for Emacs, but much much fast and safe. Please look http://www.flickr.com/photos/48809...@n02/5304662424/lightbox/ to understand hot-swap framework. Example, copy IrcClient.hs (https://patch-tag.com/r/AndyStewart/manatee-ircclient/snapshot/current/content/pretty/Config/ IrcClient.hs) to directory ~/.manatee/config/ then you can modify IrcClient.hs when manatee-ircclient is running, you just need press C-u to dynamic loading new version to *running* manatee-ircclient and won't lose state. Because GHC won't release memory after you dynamic-linking new version, so i recommend use this features as *develop mode* to accelerate develop. Once you adjust finish, you can press C-i to compile current configure file to build new manatee-ircclient. Next step, I will focus my time on IDE features Enjoy! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to reload module that package has linked in memory?
Hi Albert, Thanks for reply! "Albert Y. C. Lai" writes: > On 10-12-25 10:47 AM, Andy Stewart wrote: >> I use Linker.linkPackages and Linker.getHValue to get symbol value, but >> looks Linker.getHValue can't get *update* value once current package has >> linked in memory. >> >> So how to make Linker.getHValue can get *update* value and don't need >> install *new* package in Cabal/GHC database? >> How to *reload* module with current version package? > > Cannot be done. Unfortunately, my library just miss this part. But i think reload same package must be can work, in principle. > I suggest using no packages if you want a module refreshed. This is means > using > GHC.setTargets and GHC.load (I personally use loadWithLogger for improved > error handling). You can > still use Linker.getHValue at the end. If not use package, we need handle depend problem self. Example, same module name exist in two different depend package, we need pass -package information myself, and no those problems if use cabal package. > > See also > http://thread.gmane.org/gmane.comp.lang.haskell.glasgow.user/18742/focus=18749 Do you have any improve code than above? :) Thanks for help! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to reload module that package has linked in memory?
Hi all, I'm working on how to dynamic loading library into *running* program. I can dynamic loading/update module into *running* program if have *new* package installed. Example, when program *startup* and loading package foo-0.0.1 with function : api :: String -> String api = reverse then, i change `api` and install by foo-0.0.2: api :: String -> String api = show . length and dynamic-linking foo-0.0.2 works fine, i change api's value in *runtime*. And problem is, my solution just work when you install *new* package in Cabal/GHC database (foo-0.0.1 => foo-0.0.2), if i just change `api` value and don't install *new* package, my code can't work. I use Linker.linkPackages and Linker.getHValue to get symbol value, but looks Linker.getHValue can't get *update* value once current package has linked in memory. So how to make Linker.getHValue can get *update* value and don't need install *new* package in Cabal/GHC database? How to *reload* module with current version package? Or any GHC-API missing? Below is my source code, you just need look function `load`. Thanks! :) -- Andy --> source code start <-- module System.Dynload ( PackageVersion (..), dynload ) where import Control.Monad (forM_) import Data.IORef import GHC.Paths (libdir) import MonadUtils (liftIO) import Data.List import Data.Ord import Distribution.Package import qualified DynFlags import qualified Exception import qualified GHC import qualified HscTypes import qualified IOEnv import qualified Linker import qualified LoadIface import qualified Maybes import qualified Module import qualified Name import qualified OccName import qualified Outputable import qualified PackageConfig as PC import qualified Packages import qualified SrcLoc import qualified TcRnTypes import qualified UniqSupply import qualified Unique data PackageVersion = Newest | Version String deriving (Ord, Show, Eq) dynload :: (String, PackageVersion, String, [(String, Linker.HValue -> IO ())]) -> IO () dynload (packageName, packageVersion, moduleName, loadList) = GHC.defaultErrorHandler DynFlags.defaultDynFlags $ GHC.runGhc (Just libdir) $ do -- Update Flags of session. sessionFlags <- GHC.getSessionDynFlags GHC.setSessionDynFlags sessionFlags -- this is ncessary, otherwise get GHC error -- Initialise package information. (flags, _) <- liftIO $ Packages.initPackages sessionFlags -- Search packages that export modules. let packages = map fst $ filter snd $ Packages.lookupModuleInAllPackages flags (Module.mkModuleName moduleName) exportError pName mName = "# Package " ++ pName ++ " not exist or not export module " ++ mName result = case packages of [] -> Left $ "# No package export module : " ++ moduleName _ -> let matchPackages = filter (\x -> packageConfigName x == packageName) packages in case matchPackages of [] -> Left $ exportError packageName moduleName _ -> case packageVersion of Version pv -> let pName= packageName ++ "-" ++ pv versions = map packageConfigVersion matchPackages in if pv `elem` versions then Right pName else Left $ exportError pName moduleName Newest -> case findNewestPackage matchPackages of Nothing -> Left "# dynload : Impossible reach here" Just packageConfig -> Right $ packageConfigIdString packageConfig case result of Left err -> liftIO $ putStrLn err Right packageNameStr -> do liftIO $ putStrLn $ "* Use package : " ++ packageNameStr -- Initialise the dynamic linker. liftIO $ Linker.initDynLinker flags hscEnv <- GHC.getSession forM_ loadList $ \ (symbolName, loadFun) -> do -- Because symbol perhaps re-export from external module. -- So we need parse symbol to find define location. parseResult <- liftIO $ parseSymbol (packageNameStr, moduleName, symbolName) hscEnv flags case parseResult of Just args -> load args flags loadFun Nothing -> return () -- | Internal load function for pdynload. load :: (GHC.GhcMonad m) => (String, String, String) -> GHC.DynFlags -> (Linke
[Haskell-cafe] Looking for Haskell job at China.
Hi all, I'm a Chinese haskeller, i'm looking for haskell job at *China*. Please contact me if any Chinese company interested me. Below is my skills: * Java : (2007-06 ~ 2008-09) Worked on a variety of commercial J2ME games, masterpiece <> : http://goo.gl/lcJF * Elisp : (2008-07 ~ 2009-05) Emacs expert, developed over a large number of Emacs extensions : http://goo.gl/DNLj My best-known Emacs extensions are: AutoInstall (automatic installation of Emacs extensions): http://goo.gl/ogBY MultiTerm (terminal emulator): http://goo.gl/PwpO Yaoddmuse (OddmuseWiki editor): http://goo.gl/cUrA ElispFormat (Elisp formatter): http://goo.gl/nVzb Irfc (RFC document reader): http://goo.gl/XZwi ... too much :) Other emacs extensions and elisp code, please see my EmacsWiki homepage: http://goo.gl/DNLj * Haskell : (2009-05 ~ 2010) Haskell/Gtk+ expert. Developer of gtk2hs (Haskell binding to GTK+) : http://goo.gl/AhJw Development of a large number of Haskell libraries: http://goo.gl/CoV0 I'm developing my own Haskell operating system : Video: http://www.youtube.com/watch?v=weS6zys3U8k Homepage: http://hackage.haskell.org/package/manatee Screenshots:http://goo.gl/MkVw Framework: http://goo.gl/otfb http://goo.gl/DMFW Source Repository: http://goo.gl/CoV0 I have finish below modules in my Haskell OS: Webkit-Browser: http://goo.gl/uoaX Editor: http://goo.gl/ouDR File Manager: http://goo.gl/x8Xi Picture Viewer: http://goo.gl/EYih PDF reader: http://goo.gl/8jCK Process Manager: http://goo.gl/ISOr Music Player: http://goo.gl/TMeD IRC client: http://goo.gl/kY6v News reader: http://goo.gl/BYVp Download-Manager: http://goo.gl/30tTN Terminal-Emulator: http://goo.gl/VMyaN Below are modules in developing: Mail-Client, IDE framework Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: mime-mail 0.1.0
Michael Snoyman writes: > Hi all (again), > > I'm happy to announce the second major release of the mime-mail[1] > package. mime-mail is a package providing support for rendering > multipart emails. This new release introduces: > > * A partHeaders record, allowing you to place arbitrary headers on > individual parts of a message. This is especially useful for ContentID > * Support for quoted-printable. There are two new Encoding > constructors added: QuotedPrintableText and QuotedPrintableBinary. > They differ in how they treat newline characters: the latter outputs > CRs and LFs in an escaped form, while the former strips all CRs and > outputs LFs as the ASCII codes for "\r\n". > * Support for encoded-word for header values. This is a completely > transparent change: now if you use non-ASCII characters in your header > values, mime-mail will automatically encode appropriately. Nice! :) I will find some time develop GUI mail-client... -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Manatee Video.
Hi steffen, I have upload new video without sound : http://www.youtube.com/watch?v=A3DgKDVkyeM Enjoy! -- Andy steffen writes: > Hi Andy, > > Can you please do something about the sound track? Loads of people are > not able to view your video, because the used content/sound track is > not available in every country... meaning youtube prohibits viewing > your video. > > On 28 Nov., 17:30, Andy Stewart wrote: >> Hi all, >> >> Many people ask "What's Manatee?" >> >> A video worth a thousand words : >> here is video (select 720p HD)http://www.youtube.com/watch?v=weS6zys3U8k >> >> And i think the correct answer to "What's Manatee?" should be : >> Depend on you how to use it. :) >> >> Other information look :http://hackage.haskell.org/package/manatee >> >> Enjoy! >> >> -- Andy >> >> ___ >> Haskell-Cafe mailing list >> haskell-c...@haskell.orghttp://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] Manatee Video.
steffen writes: > these links don't work either... > But there is an alternative video link to youko (http://v.youku.com/ > v_show/id_XMjI2MDMzODI4.html) on the hackage page which works fine. That's video is not clear, so you can't see detail of my operation. I'm uploadind new video without sound track but slow upload speed in China (you know, because GFW) > > Looks interesting. > All those tabs and layout makes me wonder if manatee can become a > window manager of it's own. Say combining the launcher thing, Manatee > modes and window management into one application. Maybe by making > Manatee an opt in module for xmonad?!? Would this be possible? Manatee is design for OS. In principle, it's just need Linux Kernel and GTK+, don't need any WM, or any Desktop Environment's help. Because it's MVC design, so i can get *any* *unlimited* view for current buffer, XMonad and current X window can't do that if not change application's code. Example, i open any component tab (such as browser, editor), i can use M-t (M-T) split current winodw with two windows to provide different view of current buffer and and those view *share* same data in buffer. Such as, i can split two window to view/edit different part of source code. XMonad or any WM just provide split tiling to mix different application, but it can't split two (or more) *view* on *same* application. Here have framework illustrate help you understand Manatee's framework : http://www.flickr.com/photos/48809...@n02/5031811365/lightbox/ -- Andy > > > On 30 Nov., 15:10, Andy Stewart wrote: >> steffen writes: >> > Hi Andy, >> >> > Can you please do something about the sound track? Loads of people are >> > not able to view your video, because the used content/sound track is >> > not available in every country... meaning youtube prohibits viewing >> > your video. >> >> I will found some time upload a new video without sound. >> >> BTW, you can download video from below links: >> >> http://25.tel.115cdn.com/pickdown/M00/34/92/cWmqJkzxczoAFibVVCN3G... >> >> http://25.bak.115cdn.com/pickdown/11fec1f2ed229257059e426ab3c259714cf... >> >> Thanks for your suggestion. :) >> >> -- Andy >> >> >> >> >> >> >> >> >> >> >> >> > On 28 Nov., 17:30, Andy Stewart wrote: >> >> Hi all, >> >> >> Many people ask "What's Manatee?" >> >> >> A video worth a thousand words : >> >> here is video (select 720p HD)http://www.youtube.com/watch?v=weS6zys3U8k >> >> >> And i think the correct answer to "What's Manatee?" should be : >> >> Depend on you how to use it. :) >> >> >> Other information look :http://hackage.haskell.org/package/manatee >> >> >> Enjoy! >> >> >> -- Andy >> >> >> ___ >> >> Haskell-Cafe mailing list >> >> haskell-c...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe >> >> ___ >> Haskell-Cafe mailing list >> haskell-c...@haskell.orghttp://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] Manatee Video.
steffen writes: > Hi Andy, > > Can you please do something about the sound track? Loads of people are > not able to view your video, because the used content/sound track is > not available in every country... meaning youtube prohibits viewing > your video. I will found some time upload a new video without sound. BTW, you can download video from below links: http://25.tel.115cdn.com/pickdown/M00/34/92/cWmqJkzxczoAFibVVCN3Gk04038387/Manatee.avi?key=7eabbfafbe48579e4187a69a18e3a658&key1=4cf504f7&file=Manatee.avi&key2=3131332e37382e35302e323433 http://25.bak.115cdn.com/pickdown/11fec1f2ed229257059e426ab3c259714cf52117/M00/34/92/cWmqJkzxczoAFibVVCN3Gk04038387/Manatee.avi?file=Manatee.avi&key1=4cf504f7&key2=3131332e37382e35302e323433 Thanks for your suggestion. :) -- Andy > > On 28 Nov., 17:30, Andy Stewart wrote: >> Hi all, >> >> Many people ask "What's Manatee?" >> >> A video worth a thousand words : >> here is video (select 720p HD)http://www.youtube.com/watch?v=weS6zys3U8k >> >> And i think the correct answer to "What's Manatee?" should be : >> Depend on you how to use it. :) >> >> Other information look :http://hackage.haskell.org/package/manatee >> >> Enjoy! >> >> -- Andy >> >> ___ >> Haskell-Cafe mailing list >> haskell-c...@haskell.orghttp://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] Manatee Video.
Hi steffen, I'm uploading new video without sound track, i will post link when i upload finish. Thanks, -- Andy steffen writes: > Hi Andy, > > Can you please do something about the sound track? Loads of people are > not able to view your video, because the used content/sound track is > not available in every country... meaning youtube prohibits viewing > your video. > > On 28 Nov., 17:30, Andy Stewart wrote: >> Hi all, >> >> Many people ask "What's Manatee?" >> >> A video worth a thousand words : >> here is video (select 720p HD)http://www.youtube.com/watch?v=weS6zys3U8k >> >> And i think the correct answer to "What's Manatee?" should be : >> Depend on you how to use it. :) >> >> Other information look :http://hackage.haskell.org/package/manatee >> >> Enjoy! >> >> -- Andy >> >> ___ >> Haskell-Cafe mailing list >> haskell-c...@haskell.orghttp://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] Manatee Video.
Hi all, Many people ask "What's Manatee?" A video worth a thousand words : here is video (select 720p HD) http://www.youtube.com/watch?v=weS6zys3U8k And i think the correct answer to "What's Manatee?" should be : Depend on you how to use it. :) Other information look : http://hackage.haskell.org/package/manatee Enjoy! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Manatee - The Haskell/Gtk+ Integrated Live Environment first version release!
Hi Karel, I think is your cabal too old BTW, i suggest install GHC-6.12.3 with gtk2hs-0.12.0 and manatee. -- Andy Karel Gardas writes: > On 11/12/10 04:37, Andy Stewart wrote: >> Hi all, >> >> I have write Simple Manual at http://haskell.org/haskellwiki/Manatee >> >> Enjoy! :) > > Hello! > > I'm trying to follow installation steps on OpenSolaris 2009.06, but glib > installation fails with: > > $ cabal install --user glib > Resolving dependencies... > Downloading glib-0.12.0... > > /tmp/glib-0.12.015451/glib-0.12.0/Gtk2HsSetup.hs:25:0: > warning: #warning Setup.hs is guessing the version of Cabal. If > compilation of Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal > version 1.x.0 when building (prefixed by --ghc-option= when using the > 'cabal' command) > [1 of 2] Compiling Gtk2HsSetup ( > /tmp/glib-0.12.015451/glib-0.12.0/Gtk2HsSetup.hs, > /tmp/glib-0.12.015451/glib-0.12.0/dist/setup/Gtk2HsSetup.o ) > > /tmp/glib-0.12.015451/glib-0.12.0/Gtk2HsSetup.hs:56:2: > Module > `Distribution.Simple.PackageIndex' > does not export > `lookupPackageId' > cabal: Error: some packages failed to install: > glib-0.12.0 failed during the configure step. The exception was: > ExitFailure 1 > > > My cabal is: > > $ cabal --version > cabal-install version 0.8.2 > using version 1.8.0.2 of the Cabal library > > And ghc is: > > $ ghc --version > The Glorious Glasgow Haskell Compilation System, version 6.10.4 > > Do you have any idea what to do with this failure? i.e. is my cabal old > or is it something different... > > Thanks, > Karel > PS: Manatee screenshots are amazing and your code lines list even more! > >> >> -- Andy >> >> Andy Stewart writes: >> >>> Hi all, >>> >>> I am proud to announce the release my gtk2hs project : Manatee - The >>> Haskell/Gtk+ Integrated Live >>> Environment >>> >>> http://hackage.haskell.org/package/manatee >>> >>> Screenshots at : http:goo.gl/MkVw >>> Code at https://patch-tag.com/r/AndyStewart/ beginning with manatee-* >>> >>> Manatee is Haskell integrated environment written in Haskell. >>> >>> The goal of the Manatee project is to provide a fast, safe and flexible >>> integrated environment for haskell hacking. >>> >>> You can consider it is new environment mix Gnome and Emacs. >>> Like Gnome to provide friendly graphics interface and work efficient like >>> Emacs. >>> >>> Manatee use multi-processes framework, any sub-module running in separate >>> process to protected > core >>> won't crash. So it >>> minimize your losses when some unexpected exception throw in extension. >>> >>> Now i have implement below sub-modules in Manatee: >>> >>> Editor >>> Webkit Browser >>> File Manager >>> Image Viewer >>> IRC Client >>> Multimedia Player >>> PDF Viewer >>> Process Manager >>> RSS/Atom reader >>> >>> >From some friends feedback, manatee can't work in XMonad, i will fix it >>> >soon. >>> You can play it in Gnome. Enjoy! :) >>> >>> Below are steps to build Manatee: >>> >>> 1) Install C library: In Debian use below command: >>> >>> sudo aptitude install libgtksourceview2.0-dev libgconf2-dev libwebkit-dev >>> libcurl4-openssl-dev >>> libgtkimageview-dev libpoppler-glib-dev poppler-data libtagc0-dev -y >>> >>> 2) Install Gtk2hs: >>> >>> cabal install gtk2hs-buildtools gtk >>> >>> And make sure HOME.cabalbin/ in your PATH. >>> >>> 3) Install Manatee: >>> >>> cabal install manatee-core manatee-anything manatee-browser manatee-editor >>> manatee-filemanager >>> manatee-imageviewer manatee-ircclient manatee-mplayer manatee-pdfviewer >>> manatee-processmanager >>> manatee-reader manatee >>> >>> That's all, then type command manatee to play it! :) >>> >>> "manatee-core" "manatee-anything" "manatee" are core packages, must be >>> install, other extension package you can choose you want. >>> >>> Example, if you not install manatee-imageviewer, when you open Image >>> file, manatee will call default image-viewer in your system instead. >>> >>> Manatee will show you "search inter
Re: [Haskell-cafe] Re: Manatee - The Haskell/Gtk+ Integrated Live Environment first version release!
David Leimbach writes: > Wow! > > Is this just for Linux or is anyone able to run it on Mac OS X? I don't know whether can work on Mac. I design it for Linux. -- Andy > > Dave > > On Thu, Nov 11, 2010 at 7:51 PM, Andy Stewart > wrote: > > My project want to provide a fact: > > Haskell not just can do GUI environment, and can do better! > > Gtk2hs + Haskell Threads is awesome! > > Below is source code lines of Manatee: > > All : 21651 > > Core and toolkit : 7047 > Daemon and Window Manager : 3656 > Multi-Threads input framework: 2537 > Browser : 488 > Editor : 813 > File manager : 774 > Image viewer : 565 > IRC client : 2212 > Multimedia player : 1358 > PDF viewer : 457 > Process Manager : 761 > RSS/Atom reader : 893 > > -- Andy > > Andy Stewart writes: > > > Hi all, > > > > I am proud to announce the release my gtk2hs project : Manatee - The > Haskell/Gtk+ Integrated > Live > > Environment > > > > http://hackage.haskell.org/package/manatee > > > > Screenshots at : http:goo.gl/MkVw > > Code at https://patch-tag.com/r/AndyStewart/ beginning with manatee-* > > > > Manatee is Haskell integrated environment written in Haskell. > > > > The goal of the Manatee project is to provide a fast, safe and flexible > > integrated environment for haskell hacking. > > > > You can consider it is new environment mix Gnome and Emacs. > > Like Gnome to provide friendly graphics interface and work efficient > like Emacs. > > > > Manatee use multi-processes framework, any sub-module running in > separate process to protected > core > > won't crash. So it > > minimize your losses when some unexpected exception throw in extension. > > > > Now i have implement below sub-modules in Manatee: > > > > Editor > > Webkit Browser > > File Manager > > Image Viewer > > IRC Client > > Multimedia Player > > PDF Viewer > > Process Manager > > RSS/Atom reader > > > >>From some friends feedback, manatee can't work in XMonad, i will fix it > soon. > > You can play it in Gnome. Enjoy! :) > > > > Below are steps to build Manatee: > > > > 1) Install C library: In Debian use below command: > > > > sudo aptitude install libgtksourceview2.0-dev libgconf2-dev > libwebkit-dev > libcurl4-openssl-dev > > libgtkimageview-dev libpoppler-glib-dev poppler-data libtagc0-dev -y > > > > 2) Install Gtk2hs: > > > > cabal install gtk2hs-buildtools gtk > > > > And make sure HOME.cabalbin/ in your PATH. > > > > 3) Install Manatee: > > > > cabal install manatee-core manatee-anything manatee-browser > manatee-editor > manatee-filemanager > > manatee-imageviewer manatee-ircclient manatee-mplayer manatee-pdfviewer > manatee-processmanager > > manatee-reader manatee > > > > That's all, then type command manatee to play it! :) > > > > "manatee-core" "manatee-anything" "manatee" are core packages, must be > > install, other extension package you can choose you want. > > > > Example, if you not install manatee-imageviewer, when you open Image > > file, manatee will call default image-viewer in your system instead. > > > > Manatee will show you "search interface" when you startup it. > > You can type some filepath or url to open it, > > example, you can type Haskell file to open in editor, > > and type url to open in browser. > > > > Below are quick play keys: > > > > "F2" ==> startProcessManager > > "F3" ==> startFeedReader > > "F4" ==> startFileManager > > "F5" ==> startBrowser > > "F6" ==> loginIrcDefaultChannel > > "F7" ==> startIrc > > > > Manatee project still in early develop stage,
[Haskell-cafe] Re: Manatee - The Haskell/Gtk+ Integrated Live Environment first version release!
My project want to provide a fact: Haskell not just can do GUI environment, and can do better! Gtk2hs + Haskell Threads is awesome! Below is source code lines of Manatee: All : 21651 Core and toolkit : 7047 Daemon and Window Manager: 3656 Multi-Threads input framework: 2537 Browser : 488 Editor : 813 File manager : 774 Image viewer : 565 IRC client : 2212 Multimedia player: 1358 PDF viewer : 457 Process Manager : 761 RSS/Atom reader : 893 -- Andy Andy Stewart writes: > Hi all, > > I am proud to announce the release my gtk2hs project : Manatee - The > Haskell/Gtk+ Integrated Live > Environment > > http://hackage.haskell.org/package/manatee > > Screenshots at : http:goo.gl/MkVw > Code at https://patch-tag.com/r/AndyStewart/ beginning with manatee-* > > Manatee is Haskell integrated environment written in Haskell. > > The goal of the Manatee project is to provide a fast, safe and flexible > integrated environment for haskell hacking. > > You can consider it is new environment mix Gnome and Emacs. > Like Gnome to provide friendly graphics interface and work efficient like > Emacs. > > Manatee use multi-processes framework, any sub-module running in separate > process to protected core > won't crash. So it > minimize your losses when some unexpected exception throw in extension. > > Now i have implement below sub-modules in Manatee: > > Editor > Webkit Browser > File Manager > Image Viewer > IRC Client > Multimedia Player > PDF Viewer > Process Manager > RSS/Atom reader > >>From some friends feedback, manatee can't work in XMonad, i will fix it soon. > You can play it in Gnome. Enjoy! :) > > Below are steps to build Manatee: > > 1) Install C library: In Debian use below command: > > sudo aptitude install libgtksourceview2.0-dev libgconf2-dev libwebkit-dev > libcurl4-openssl-dev > libgtkimageview-dev libpoppler-glib-dev poppler-data libtagc0-dev -y > > 2) Install Gtk2hs: > > cabal install gtk2hs-buildtools gtk > > And make sure HOME.cabalbin/ in your PATH. > > 3) Install Manatee: > > cabal install manatee-core manatee-anything manatee-browser manatee-editor > manatee-filemanager > manatee-imageviewer manatee-ircclient manatee-mplayer manatee-pdfviewer > manatee-processmanager > manatee-reader manatee > > That's all, then type command manatee to play it! :) > > "manatee-core" "manatee-anything" "manatee" are core packages, must be > install, other extension package you can choose you want. > > Example, if you not install manatee-imageviewer, when you open Image > file, manatee will call default image-viewer in your system instead. > > Manatee will show you "search interface" when you startup it. > You can type some filepath or url to open it, > example, you can type Haskell file to open in editor, > and type url to open in browser. > > Below are quick play keys: > > "F2" ==> startProcessManager > "F3" ==> startFeedReader > "F4" ==> startFileManager > "F5" ==> startBrowser > "F6" ==> loginIrcDefaultChannel > "F7" ==> startIrc > > Manatee project still in early develop stage, just core framework > finish, many details still not perfect. > > But i think it's good start to build Real-World application in Haskell. > > Below are high task in my TODO list: > > Perfect current sub-module: > IDE features, code completion > browser JavaScript framework > graphics custom system > etc. > > Terminal emulator: > support MVC design, not like VTE widget > > Mail-client > > BT-Client > > Proxy bridge: > to build uniform proxy interface to fighting GFW!!! > > Jabbar client: > video support etc. > > Spell checker > > CHM viewer > > DVI viewer > > LaTex editor > > PS viewer > > Multi-thread download manager > > Org-Mode : http://orgmode.org/ > > Twitter client > > Network toolkit: > sniffer etc. > > Multi-Language translater > offline support > > Too many ideas lying in my TODO list > > Any suggestion and contribution are welcome! :) > > -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Manatee - The Haskell/Gtk+ Integrated Live Environment first version release!
Hi all, I have write Simple Manual at http://haskell.org/haskellwiki/Manatee Enjoy! :) -- Andy Andy Stewart writes: > Hi all, > > I am proud to announce the release my gtk2hs project : Manatee - The > Haskell/Gtk+ Integrated Live > Environment > > http://hackage.haskell.org/package/manatee > > Screenshots at : http:goo.gl/MkVw > Code at https://patch-tag.com/r/AndyStewart/ beginning with manatee-* > > Manatee is Haskell integrated environment written in Haskell. > > The goal of the Manatee project is to provide a fast, safe and flexible > integrated environment for haskell hacking. > > You can consider it is new environment mix Gnome and Emacs. > Like Gnome to provide friendly graphics interface and work efficient like > Emacs. > > Manatee use multi-processes framework, any sub-module running in separate > process to protected core > won't crash. So it > minimize your losses when some unexpected exception throw in extension. > > Now i have implement below sub-modules in Manatee: > > Editor > Webkit Browser > File Manager > Image Viewer > IRC Client > Multimedia Player > PDF Viewer > Process Manager > RSS/Atom reader > >>From some friends feedback, manatee can't work in XMonad, i will fix it soon. > You can play it in Gnome. Enjoy! :) > > Below are steps to build Manatee: > > 1) Install C library: In Debian use below command: > > sudo aptitude install libgtksourceview2.0-dev libgconf2-dev libwebkit-dev > libcurl4-openssl-dev > libgtkimageview-dev libpoppler-glib-dev poppler-data libtagc0-dev -y > > 2) Install Gtk2hs: > > cabal install gtk2hs-buildtools gtk > > And make sure HOME.cabalbin/ in your PATH. > > 3) Install Manatee: > > cabal install manatee-core manatee-anything manatee-browser manatee-editor > manatee-filemanager > manatee-imageviewer manatee-ircclient manatee-mplayer manatee-pdfviewer > manatee-processmanager > manatee-reader manatee > > That's all, then type command manatee to play it! :) > > "manatee-core" "manatee-anything" "manatee" are core packages, must be > install, other extension package you can choose you want. > > Example, if you not install manatee-imageviewer, when you open Image > file, manatee will call default image-viewer in your system instead. > > Manatee will show you "search interface" when you startup it. > You can type some filepath or url to open it, > example, you can type Haskell file to open in editor, > and type url to open in browser. > > Below are quick play keys: > > "F2" ==> startProcessManager > "F3" ==> startFeedReader > "F4" ==> startFileManager > "F5" ==> startBrowser > "F6" ==> loginIrcDefaultChannel > "F7" ==> startIrc > > Manatee project still in early develop stage, just core framework > finish, many details still not perfect. > > But i think it's good start to build Real-World application in Haskell. > > Below are high task in my TODO list: > > Perfect current sub-module: > IDE features, code completion > browser JavaScript framework > graphics custom system > etc. > > Terminal emulator: > support MVC design, not like VTE widget > > Mail-client > > BT-Client > > Proxy bridge: > to build uniform proxy interface to fighting GFW!!! > > Jabbar client: > video support etc. > > Spell checker > > CHM viewer > > DVI viewer > > LaTex editor > > PS viewer > > Multi-thread download manager > > Org-Mode : http://orgmode.org/ > > Twitter client > > Network toolkit: > sniffer etc. > > Multi-Language translater > offline support > > Too many ideas lying in my TODO list > > Any suggestion and contribution are welcome! :) > > -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Manatee - The Haskell/Gtk+ Integrated Live Environment first version release!
Hi all, I am proud to announce the release my gtk2hs project : Manatee - The Haskell/Gtk+ Integrated Live Environment http://hackage.haskell.org/package/manatee Screenshots at : http:goo.gl/MkVw Code at https://patch-tag.com/r/AndyStewart/ beginning with manatee-* Manatee is Haskell integrated environment written in Haskell. The goal of the Manatee project is to provide a fast, safe and flexible integrated environment for haskell hacking. You can consider it is new environment mix Gnome and Emacs. Like Gnome to provide friendly graphics interface and work efficient like Emacs. Manatee use multi-processes framework, any sub-module running in separate process to protected core won't crash. So it minimize your losses when some unexpected exception throw in extension. Now i have implement below sub-modules in Manatee: Editor Webkit Browser File Manager Image Viewer IRC Client Multimedia Player PDF Viewer Process Manager RSS/Atom reader >From some friends feedback, manatee can't work in XMonad, i will fix it soon. You can play it in Gnome. Enjoy! :) Below are steps to build Manatee: 1) Install C library: In Debian use below command: sudo aptitude install libgtksourceview2.0-dev libgconf2-dev libwebkit-dev libcurl4-openssl-dev libgtkimageview-dev libpoppler-glib-dev poppler-data libtagc0-dev -y 2) Install Gtk2hs: cabal install gtk2hs-buildtools gtk And make sure HOME.cabalbin/ in your PATH. 3) Install Manatee: cabal install manatee-core manatee-anything manatee-browser manatee-editor manatee-filemanager manatee-imageviewer manatee-ircclient manatee-mplayer manatee-pdfviewer manatee-processmanager manatee-reader manatee That's all, then type command manatee to play it! :) "manatee-core" "manatee-anything" "manatee" are core packages, must be install, other extension package you can choose you want. Example, if you not install manatee-imageviewer, when you open Image file, manatee will call default image-viewer in your system instead. Manatee will show you "search interface" when you startup it. You can type some filepath or url to open it, example, you can type Haskell file to open in editor, and type url to open in browser. Below are quick play keys: "F2" ==> startProcessManager "F3" ==> startFeedReader "F4" ==> startFileManager "F5" ==> startBrowser "F6" ==> loginIrcDefaultChannel "F7" ==> startIrc Manatee project still in early develop stage, just core framework finish, many details still not perfect. But i think it's good start to build Real-World application in Haskell. Below are high task in my TODO list: Perfect current sub-module: IDE features, code completion browser JavaScript framework graphics custom system etc. Terminal emulator: support MVC design, not like VTE widget Mail-client BT-Client Proxy bridge: to build uniform proxy interface to fighting GFW!!! Jabbar client: video support etc. Spell checker CHM viewer DVI viewer LaTex editor PS viewer Multi-thread download manager Org-Mode : http://orgmode.org/ Twitter client Network toolkit: sniffer etc. Multi-Language translater offline support Too many ideas lying in my TODO list Any suggestion and contribution are welcome! :) -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Does it deserve to be a hackage package?
Dmitry V'yal writes: > On 27.10.2010 13:16, Andy Stewart wrote: >> Christopher Done writes: >> >>> On 27 October 2010 10:13, Dmitry V'yal wrote: >>>> While ago I had a question about opening the url in the default browser >>>> from >>>> haskell program. I didn't get any immediate answers so I wrote my own >>>> solution. On Linux it uses xdg-open and on Windows - ShellExecute Api. >>> >>>> Does it deserve to be a hackage package? >>> >>> If it's not in an existing small library, yes. If I have to have a >>> dependency on gtk2hs just to do that, I'd rather have a small library. >>> Does it work on OS X? If not, I'm sure someone would submit a patch >>> for that. This can also be used for opening the file browser and such, >>> right? >> It's APIs in GIO library (a sub-library in gtk2hs), you just need depend >> on GIO don't need depend any other library. >> >> Dmitry, it's unnecessary since GIO can do better with same experience >> both Windows and Linux, don't need any external program help. >> Infact, GIO not just call default browser for url, it can call any >> program to open any format. > > Ok then. I'll wait for it. > I hope binary package for Windows would be provided too. Currently I can't > figure out how build > gtk2hs there. I guess we won't provide binary package for Windows, but i can tell you how to build gtk2hs on Windows: First: see http://code.haskell.org/gtk2hs/INSTALL short summary: http://www.gtk.org/download-windows.html and download one of the "All-in-one bundles". Note that you need to have ~/.cabal/bin on your PATH since otherwise building the libraries will fail, saying that e.g. gtk2hsC2hs cannot be found. Then do "cabal install gtk2hs-buildtools gtk" will install gtk2hs. I suggest you pull gtk2hs darcs code first to test the GIO code i send you before. When build gtk2hs darcs, you need replace "cabal install gtk2hs-buildtools gtk" with below commands: darcs get --lazy http://code.haskell.org/gtk2hs/ cd ./gtk2hs sudo chmod +x ./bootstrap.sh ./bootstrap.sh Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskell and a complete mail client lib?
Günther Schmidt writes: > Hi all, > > do we Haskellers have a complete Mail client library? > > One that goes beyond an unstructured byte string? I want mail-client library too, for my gtk2hs project (http://www.flickr.com/photos/48809...@n02/) If still haven't complete mail-client library when i want build mail-client, i will write one. Please let me know if someone working on mail-client library, i want play. :) Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Does it deserve to be a hackage package?
Christopher Done writes: > On 27 October 2010 10:13, Dmitry V'yal wrote: >> While ago I had a question about opening the url in the default browser from >> haskell program. I didn't get any immediate answers so I wrote my own >> solution. On Linux it uses xdg-open and on Windows - ShellExecute Api. > >> Does it deserve to be a hackage package? > > If it's not in an existing small library, yes. If I have to have a > dependency on gtk2hs just to do that, I'd rather have a small library. > Does it work on OS X? If not, I'm sure someone would submit a patch > for that. This can also be used for opening the file browser and such, > right? It's APIs in GIO library (a sub-library in gtk2hs), you just need depend on GIO don't need depend any other library. Dmitry, it's unnecessary since GIO can do better with same experience both Windows and Linux, don't need any external program help. Infact, GIO not just call default browser for url, it can call any program to open any format. Example, you install many different PDF-Viewer in your system, it will return a Application list for *.pdf format...etc. Good news is, gtk2hs-0.12.0 has ready for release, we will wait one week, if no user report any bug of gtk2hs darcs, we will release. Then you can use it. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Help me TH code.
Serguey Zefirov writes: > 2010/10/27 Andy Stewart : >> Hi all, >> >> I want use TH write some function like below: >> >> data DataType = StringT >> | IntT >> | CharT >> >> parse :: [(String,DataType)] -> (TypeA, TypeB, ... TypeN) >> >> Example: >> >> parse [("string", StringT), ("001", IntT), ("c", CharT)] >> >> will return: >> >> ("string", 001, 'c') >> >> So how to use TH write 'parse' function? > > I think that you should use TH properly, without compiler and logical errors. > > What actually do you want? I'm build multi-processes communication program. Example i have two processes : Client and Server. At Client side, i pass [DataType] to Server, example: [StringT, IntT, CharT] Server will handle "user input" with [DataType] and return result [String] to Client side, example: ["string", "001", "c"] Then at Client side, i need parse [String] to get real value: ("string", 001, 'c') Because, [DataType] have many different case, so i want pass [String] between processes, and use TH parse result [String] at Client side. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Help me TH code.
Hi all, I want use TH write some function like below: data DataType = StringT | IntT | CharT parse :: [(String,DataType)] -> (TypeA, TypeB, ... TypeN) Example: parse [("string", StringT), ("001", IntT), ("c", CharT)] will return: ("string", 001, 'c') So how to use TH write 'parse' function? Thanks! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Redy to release gtk2hs-0.12.0!
Felipe Lessa writes: > Great! What's new in 0.12.0? I don't see a NEWS file and the ChangeLog is > old. Use command "darcs changes" see detail. The NEWS in gtk2hs-0.12.0 : * Support all APIs from GTK+2.8 ~ GTK+2.22 Look http://www.gtk.org/language-bindings.html Of course, if some work Haskell library can do better, we won't binding. * Support newest GIO library (Cross platform file APIs) You can use GIO develop cross-platform file-manager, like this : http://www.flickr.com/photos/48809...@n02/4793031888/lightbox/ * Fix *many* GObject's memory leak (derive from GObject but not derive GInitiallyUnowned) Example, now you can use Pixbuf build your own ImageViewer, and no memory leak! There is memory monitor for image viewer : http://www.flickr.com/photos/48809...@n02/5063946143/lightbox/ * And many bugs fix. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Redy to release gtk2hs-0.12.0!
Dear gtk2hs user: We have ready to release next version : gtk2hs-0.12.0 Please pull gtk2hs darcs to test, if no bug report, we will release. You can use below commands (Debian) to install gtk2hs darcs: darcs get --lazy http://code.haskell.org/gtk2hs/ cd ./gtk2hs sudo chmod +x ./bootstrap.sh ./bootstrap.sh Then recompile your gtk2hs program to test. Of course, any successful feedback are welcome! Thanks, -- Gtk2hs Team ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: hs-plugins and memory leaks
Evan Laforge writes: >> Last, i remove pdynload code from my project temporary with below reasons: >> >> 1) Hold running state is difficult, like network state in browser or >> running state in terminal emulator. > > This doesn't seem too hard to me. Provided you are not swapping the > module that defines the state in the first place, simply reload the > module, and replace the old symbol in the state with the reloaded one. > >> 2) Linking time is too long, I have haskell OS project >> (http://www.flickr.com/photos/48809...@n02/) have many sub-module, every >> sub-module is very big, and linking time is too long. > > This is discouraging, since one of the main reasons to use dynamically > loaded code instead of recompiling the whole app is to avoid long link > times. Presumably you would compile the majority of the app (the API > that the plugins use, and the internal code also uses) as a dynamic > library: > > main.o -> tiny stub that just calls app.so > app.so -> large library containing all app logic > plugin.so -> links against app.so when loaded > > So the plugin needs to read a lot of hi files when recompiling, but > the dynamic link time should be proportional to the number of > unresolved symbols in plugin.so that point into app.so, not > proportional to the overall size of the app, right? Yes, not proportional the size of application, but link time depend on the dependent packages that haven't linked. Example like the GHC API in 'pdynload' package, it will search symbol define in GHC database to get which packageId that need re-link, then use below code link: Linker.linkPackages flags [packageId] Function 'linkPackages' will link specified package and it's "dependent packages", if dependents packages is bigger, link time is longer. So the long link time is unavoidable for *big* package. > >>> So would freeing oc->image fix the leak? In my case, it's not too >>> hard to force all data structures that might reference it. >> It's not safe for GHC runtime system since you don't know when time >> unload old code is safe. > > But that's just my question, I *do* (think I) know when it's safe, > which is after the data that has passed through plugged-in code has > been fully forced. Can't I just call unloadObj then? Yes, unloadObj can work if you careful design, well it's also easy to crash your program if something miss. > > E.g., loading and unloading plugins for audio processing is totally > standard. Since the data is strict arrays of primitive types, there's > no risk of stray pointers to unloaded code. > >> Anyway, i was re-thinking hot-swap haskell some time, my idea >> is : >> >> multi-processes framework >> + hot-swapping core entry >> + mix old/new sub-module in runtime >> >> Core and sub-module all in separate processes. > > How would you pass state between processes? Infact, i won't pass any state between processes. My framework like this: http://www.flickr.com/photos/48809...@n02/5031811365/lightbox/ Every sub-module running in render process, and render process for daemon process just a *Tab*. When you need update current sub-module, just recompile new code in Cabal/GHC database, then startup *new* process to load new code, and we can use dyre technology to restore state in new process. Though it's not powerful as hs-plugins do, but perfect safety and no *memory leak*. -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: hs-plugins and memory leaks
Hi Evan, Evan Laforge writes: >>> So my questions are: >>> >>> Why did lambdabot and yi abandon plugins? >> >> Because it was unmaintained for around 5 years, and was fundamentally >> less portable than simpler state serialization solutions that offered >> some of the same benefits as full code hot swapping. > > Fair enough. The idea of being able to make changes and see them > quickly enough for it to have an interactive feel is very appealing, > but maybe there are other ways to get there, such as improving link > time with dynamic linking (my current link time is around 24 seconds). > State serialization + restart is definitely simpler and more robust. > But if it's impossible to get it fast enough otherwise, and there > aren't any other show stopping problems (I think even a known memory > leak may be dwarfed by the amount of data the app keeps in memory > anyway), then it might be worth it to me to maintain hs-plugins. > I have project design for use dynamic linking, i even build 'pdynload' (http://hackage.haskell.org/package/pdynload-0.0.3) with Don's PhD thesis. Last, i remove pdynload code from my project temporary with below reasons: 1) Hold running state is difficult, like network state in browser or running state in terminal emulator. 2) Linking time is too long, I have haskell OS project (http://www.flickr.com/photos/48809...@n02/) have many sub-module, every sub-module is very big, and linking time is too long. 3) Memory leak like you said. >>> Is unloadObj a guaranteed memory leak? As far as I can tell, it's >>> never called within ghc itself. If the choices are between a memory >>> leak no matter how you use it and dangerous but correct if you use it >>> right, shouldn't we at least have the latter available as an option? >>> E.g. a reallyUnloadObj function that also frees the image. >> >> GHC never unloads object code, so yes, it will "leak" old code. > > So would freeing oc->image fix the leak? In my case, it's not too > hard to force all data structures that might reference it. It's not safe for GHC runtime system since you don't know when time unload old code is safe. Don's idea is hold old state in memory even you load new state for hot-swapping safely. > >>> Long shot, but are there any more principled ways to guarantee no >>> pointers to a chunk of code exist? The only thing I can think of is >>> to have the state be totally strict and consist only of types from the >>> static core. Would it be possible to hand responsibility for the >>> memory off to the garbage collector? >> >> It's really hard. > > It happens in python for python bytecode, since it exists as a plain > data structure in the language. E.g. 'code = compile('xyz')'. > Couldn't a haskell solution be along the same lines? 'code <- load > "X.o"; makeFunction code', and then makeFunction holds a ForeignPtr to > the actual code and there's some kind of primitive to call a chunk of > code as a function. Anyway, i was re-thinking hot-swap haskell some time, my idea is : multi-processes framework + hot-swapping core entry + mix old/new sub-module in runtime Core and sub-module all in separate processes. With my project (http://www.flickr.com/photos/48809...@n02/), editor and browser (many other sub-module ...) are sub-module. Core don't do anything, just control how to load sub-module. Core have 'entry code', like 'pageBufferNewFun' in https://patch-tag.com/r/AndyStewart/manatee/snapshot/current/content/pretty/Manatee.hs 'sourceBufferNew', 'browserBufferNew' are 'entry function' to load sub-module in *new* process. Core process always running, so we just need hot-swapping 'entry code' after we update sub-module library by cabal, then we can use new 'entry code' load sub-module in new process, at the same time, old sub-module code still running in old process. Welcome to discuss. :) Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Opening a gtk2hs link in default browser
Hi Dmitry, Dmitry V'yal writes: > Hello list, > > I'm trying to make a clickable link in gtk2hs program. Clicking it should > open an url in the default > browser. Can I hope to find some portable solution in gtk2hs (it should work > in linux and windows) > or should I start searching platform specific ones, like /usr/bin/xdg-open or > something? > > Can any examples be found in existing haskell software? The answer is yes, use GIO function (Unfortunately, those code in gtk2hs darcs). Here is demo code: openUrlBySystemTool :: String -> IO () openUrlBySystemTool url = do infos <- appInfoGetAllForType "text/html" case infos of [] -> return () xs -> appInfoLaunchUris (head xs) [url] Nothing Function 'appInfoGetAllForType' return list of AppInfo for given contentType (like mime type for file) AppInfo is abstract type to contain application information in system (cross Windows and Linux) After you got [AppInfo] (list of program for open url) from "appInfoGetAllForType "text/html", you can use function 'appInfoLaunchUris' launch link with any program register in system. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to fix "undefined reference" error with getDataDir?
Henning Thielemann writes: > Andy Stewart schrieb: >> Hi all, >> >> I have two package A and B, and B depend A. >> >> I use below code snippets in package A: >> >> --> code start <-- >> ... >> import Paths_manatee_ircclient >> import System.FilePath >> ... >> dir <- getDataDir >> let imagePath imageName = dir "icons" (imageName ++ ".png") >> ... >> --> code end <-- >> >> Anyway, package A compile fine, but when i compile package B, i got >> below error: >> >> --> error start <-- >> Linking dist/build/manatee/manatee ... >> /home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): > In function `s6sP_info': >> (.text+0x3bea): undefined reference to > manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir3_closure' > > Often these linker problems arise if A was altered and recompiled and > not all depending parts of B were recompiled. However, 'cabal install' > which in turn calls 'ghc --make' should automatically find and compile > the affected modules of B. Maybe it fails in trying to do so. I would > try to remove dist/build of packages A and B and then compile and > install the packages again. Hi Henning, thanks for reply. I have fix this problem: I forgot add 'Paths_manatee_ircclient' in "other-modules" of A.cabal , then package A compile fine, but package B can't found path of module ''Paths_manatee_ircclient', then link failed. After i add "Paths_manatee_ircclient" in A.cabal, problem fix. Cheer, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to fix "undefined reference" error with getDataDir?
Hi all, I have two package A and B, and B depend A. I use below code snippets in package A: --> code start <-- ... import Paths_manatee_ircclient import System.FilePath ... dir <- getDataDir let imagePath imageName = dir "icons" (imageName ++ ".png") ... --> code end <-- Anyway, package A compile fine, but when i compile package B, i got below error: --> error start <-- Linking dist/build/manatee/manatee ... /home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `s6sP_info': (.text+0x3bea): undefined reference to `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir3_closure' /home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `s6sP_info': (.text+0x3bf0): undefined reference to `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir2_closure' /home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `s6Uf_info': (.text+0x560f): undefined reference to `__stginit_manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_' /home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `r5Mp_closure': (.data+0x9d8): undefined reference to `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir3_closure' /home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `r5Mp_closure': (.data+0x9e0): undefined reference to `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir2_closure' collect2: ld returned 1 exit status cabal: Error: some packages failed to install: manatee-0.0.1 failed during the building phase. The exception was: ExitFailure 1 --> error end <-- How to fix above error? Thanks! -- Andy Below is .cabal file for package A: --> A.cabal start <-- name: manatee-ircclient version:0.0.1 Cabal-Version: >= 1.6 license:GPL-3 license-file: LICENSE copyright: (c) 2009 ~ 2010 Andy Stewart synopsis: IRC client extension for Manatee. description:manatee-ircclient is IRC client extension for Manatee (Haskell/Gtk+ Integrated Live Environment) author: Andy Stewart maintainer: Andy Stewart stability: provisional category: Development, Other tested-with:GHC==6.12.3 build-type: Simple extra-source-files: Setup.lhs data-dir: icons data-files: angry.png confused.png crying.png embarrassed.png inlove.png kiss.png sleepy.png sad.png laugh.png smile.png surprised.png tired.png tongue.png whistling.png wink.png Library build-depends: base >= 4 && < 5, manatee-core >= 0.0.1, dbus-client >= 0.3 && < 0.4, stm >= 2.1.2.0, containers >= 0.3.0.0, gtk-serialized-event >= 0.11.0, gtk >= 0.11.0, text >= 0.7.1.0, bytestring >= 0.9.1.5, dbus-core, template-haskell, gtksourceview2 >= 0.11.0, unix >= 2.4.0.0, network, groom, fastirc >= 0.2.0, split >= 0.1.2, nano-md5 >= 0.1.2, filepath, regex-posix >= 0.94.1, array >= 0.3.0.0, GoogleTranslate >= 0.0.3, utf8-string, mtl, Cabal exposed-modules: Manatee.Extension.IrcClient Manatee.Extension.IrcClient.Types Manatee.Extension.IrcClient.DBus Manatee.Extension.IrcClient.Daemon Manatee.Extension.IrcClient.HighlightNick Manatee.Extension.IrcClient.IrcBuffer Manatee.Extension.IrcClient.IrcView Manatee.Extension.IrcClient.Smile other-modules: extensions: ghc-options: -O -fwarn-unused-matches -fwarn-unused-binds -fwarn-unused-imports -fwarn-overlapping-patterns -fwarn-duplicate-exports -threaded -fwarn-unrecognised-pragmas -fwarn-hi-shadowing Executable manatee-irc-daemon main-is: Main.hs ghc-options: -threaded --> A.cabal end <-- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Help us test gtk2hs darcs!
Hi all, We have add many APIs in gtk2hs darcs, and ready to release gtk2hs-0.12.0 Please help us test gtk2hs darcs, we can fix it before release gtk2hs-0.12.0 You can get gtk2hs darcs with below command: darcs get code.haskell.org/gtk2hs Please send any bug report to gtk2hs-us...@lists.sourceforge.net Thanks! -- Gtk2hs Team ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Update gtk2hs!
Hi all, I'm working on update gtk2hs APIs. 'gio' has update to newest version, all patches has push to repo, i need more test before release gio-0.12.0 About `gtk` packages, i have push some gtk+-2.18/gtk+-2.20 patches to repo but not all, i plan finish all APIs before release gtk-0.12.0. If anyone interested this, welcome to join! :) We can release gtk-0.12.0 quicker if more people join us. GTK+-2.18 new modules have *finish* at http://www2.in.tum.de/~simona/gtk2hs-2.18/gtk/Graphics/UI/Gtk/ Because have some bugs in those code (my fault), you need review every APIs before send patch, but it's much simple than build those module by yourself. Below are missing modules in gtk+-2.18: gtk/Graphics/UI/Gtk/Printing/PageSetup.chs gtk/Graphics/UI/Gtk/Printing/PaperSize.chs gtk/Graphics/UI/Gtk/Printing/PrintContext.chs gtk/Graphics/UI/Gtk/Printing/PrintOperation.chs gtk/Graphics/UI/Gtk/Printing/PrintOperationPreview.chs gtk/Graphics/UI/Gtk/Printing/PrintSettings.chs gtk/Graphics/UI/Gtk/Recent/RecentChooser.chs gtk/Graphics/UI/Gtk/Recent/RecentChooserDialog.chs gtk/Graphics/UI/Gtk/Recent/RecentChooserMenu.chs gtk/Graphics/UI/Gtk/Recent/RecentChooserWidget.chs gtk/Graphics/UI/Gtk/Recent/RecentFilter.chs gtk/Graphics/UI/Gtk/Recent/RecentInfo.chs gtk/Graphics/UI/Gtk/Recent/RecentManager.chs gtk/Graphics/UI/Gtk/Special/HRuler.chs gtk/Graphics/UI/Gtk/Special/Ruler.chs gtk/Graphics/UI/Gtk/Special/VRuler.chs gtk/Graphics/UI/Gtk/Selectors/HSV.chs gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs gtk/Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs gtk/Graphics/UI/Gtk/ActionMenuToolbar/Activatable.chs gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs gtk/Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs gtk/Graphics/UI/Gtk/Buttons/gtk/Graphics/UI/Gtk/LinkButton.chs gtk/Graphics/UI/Gtk/Buttons/gtk/Graphics/UI/Gtk/ScaleButton.chs gtk/Graphics/UI/Gtk/Buttons/gtk/Graphics/UI/Gtk/VolumeButton.chs gtk/Graphics/UI/Gtk/Display/InfoBar.chs gtk/Graphics/UI/Gtk/Entry/EntryBuffer.chs gtk/Graphics/UI/Gtk/Gdk/AppLaunchContext.chs gtk/Graphics/UI/Gtk/Gdk/Colormap.chs gtk/Graphics/UI/Gtk/Gdk/Device.chs gtk/Graphics/UI/Gtk/Gdk/DisplayManager.chs gtk/Graphics/UI/Gtk/Gdk/Keymap.chs gtk/Graphics/UI/Gtk/Gdk/PixbufLoader.chs gtk/Graphics/UI/Gtk/Gdk/Visual.chs gtk/Graphics/UI/Gtk/General/AccelGroup.chs gtk/Graphics/UI/Gtk/General/AccelMap.chs gtk/Graphics/UI/Gtk/General/Binding.chs gtk/Graphics/UI/Gtk/General/IconInfo.chs gtk/Graphics/UI/Gtk/General/Paint.chs gtk/Graphics/UI/Gtk/MenuComboToolbar/Item.chs gtk/Graphics/UI/Gtk/MenuComboToolbar/ToolShell.chs gtk/Graphics/UI/Gtk/Misc/IMContextSimple.chs gtk/Graphics/UI/Gtk/ModelView/CellEditable.chs gtk/Graphics/UI/Gtk/ModelView/CellRendererAccel.chs gtk/Graphics/UI/Gtk/ModelView/CellRendererSpin.chs GTK+2.20 just below APIs haven't finish: Index of new symbols in 2.20 C GtkCellEditable:editing-canceled, object property in GtkCellEditable GtkCellRendererSpinner:pulse, object property in GtkCellRendererSpinner GtkCellRendererSpinner:size, object property in GtkCellRendererSpinner gtk_cell_renderer_spinner_new, function in GtkCellRendererSpinner O gtk_offscreen_window_get_pixbuf, function in GtkOffscreenWindow gtk_offscreen_window_get_pixmap, function in GtkOffscreenWindow gtk_offscreen_window_new, function in GtkOffscreenWindow P gtk_paint_spinner, function in GtkStyle gtk_printer_get_hard_margins, function in GtkPrinter gtk_print_context_get_hard_margins, function in GtkPrintContext T GtkToolPalette::set-scroll-adjustments, object signal in GtkToolPalette GtkToolPalette:exclusive, object property in GtkToolPalette GtkToolPalette:expand, object property in GtkToolPalette GtkToolPalette:icon-size, object property in GtkToolPalette GtkToolPalette:icon-size-set, object property in GtkToolPalette GtkToolPalette:toolbar-style, object property in GtkToolPalette gtk_tool_item_get_ellipsize_mode, function in GtkToolItem gtk_tool_item_get_text_alignment, function in GtkToolItem gtk_tool_item_get_text_orientation, function in GtkToolItem gtk_tool_item_get_text_size_group, function in GtkToolItem gtk_tool_item_group_get_collapsed, function in GtkToolItemGroup gtk_tool_item_group_get_drop_item, function in GtkToolItemGroup gtk_tool_item_group_get_ellipsize, function in GtkToolItemGroup gtk_tool_item_group_get_header_relief, function in GtkToolItemGroup gtk_tool_item_group_get_item_position, function in GtkToolItemGroup gtk_tool_item_group_get_label, function in GtkToolItemGroup gtk_tool_item_group_get_label_widget, function in GtkToolItemGroup gtk_tool_item_group_get_nth_item, function in GtkToolItemGroup gtk_tool_item_group_get_n_items, function in GtkToolItemGroup gtk_tool_item_group_insert, function in GtkToolItemGroup gtk_tool_item_group_new, function in GtkToolItemGroup gtk_tool_item_group_set_collapsed, function in GtkToolItemGroup
[Haskell-cafe] GtkImageView release!
Hi all, I have release gtkimageview, it's a Gtk APIs for build image viewer. Here is screenshot : http://www.flickr.com/photos/48809...@n02/4909785139/ You can click right-bottom to popup navigate window to drag area in image. Here is demo : https://patch-tag.com/r/AndyStewart/gtkimageview/snapshot/current/content/pretty/demo Enjoy! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Help us test gio APIs!
Hi all, I'm working on merge gio-branch (https://patch-tag.com/r/AndyStewart/gio-branch/home) to gtk2hs-0.12.0. GIO (http://library.gnome.org/devel/gio/stable/) is cross-platform APIs for file operation, we can use gio APIs develop file manager or similar application. If anyone want to use those APIs, help us test those APIs at https://patch-tag.com/r/AndyStewart/gio-branch/home, then we can release gio-0.12.0 quicker. A GIO file-manager screenshot at : http://www.flickr.com/photos/48809...@n02/4793031888/ Thanks! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: gtk2hs with old gtk2
Johannes Waldmann writes: > Andy Stewart gmail.com> writes: > >> Just "cabal install" is enough. > > Hm. That's what bootstrap.sh does, > and it builds tools, then glib, but then: > > Preprocessing library gio-0.11.0... > gtk2hsC2hs: Errors during expansion of binding hooks: > > ./System/GIO/Types.chs:584: (column 12) [ERROR] > >>> Unknown identifier! > Cannot find a definition for `Emblem' in the header file. Because GEmblem is need Glib 2.18, mabye your glib is too old. You can use command 'pkg-config --modversion glib-2.0' check your glib version. Can you update your glib library? -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: gtk2hs with old gtk2
Johannes Waldmann writes: > I'm trying to build gtk2hs on debian/lenny, > that is, with gtk2 v. 2.12 if I understand this correctly. > > I got the gtk2hs sources from darcs (I guess it's 0.11.0) > and http://www.haskell.org/gtk2hs/ says > "You need to specify -f-gtk_2_20 for Gtk+ 2.18 etc." > I would love to, but where exactly? (When bootstrap.sh) Infact, you don't need that. Just "cabal install" is enough. Flags gtk_version just use when first cabalized gtk2hs test-version relased, now gtk2hs can choose right gtk version automatically. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: gkt2hs seg fault issue
writes: > On Mon, 09 Aug 2010 11:09:40 +0800 > Andy Stewart wrote: > >> Ivan Lazar Miljenovic writes: >> >> > On 9 August 2010 09:44, Andy Stewart >> > wrote: >> >> Which ghc version? >> >> > > The Glorious Glasgow Haskell Compilation System, version 6.12.1 > > So just run gdb on ghci to see what is happening ? Since ghci got seg fault, it's maybe the bug of gtk2hs. I recommend you download darcs version and test again. If darcs version get same error, it's new bug, then report it to gtk2hs-us...@lists.sourceforge.net Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: gkt2hs seg fault issue
Ivan Lazar Miljenovic writes: > On 9 August 2010 09:44, Andy Stewart wrote: >> Which ghc version? >> >> It's have a bug in ghc-6.12 that cause gtk2hs segment fault. > > If memory serves, that bug was only present in 6.12.2... Yes, typo, it's a bug of ghc-6.12.2 -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: gkt2hs seg fault issue
Which ghc version? It's have a bug in ghc-6.12 that cause gtk2hs segment fault. If you use other ghc version, you should use gdb run your program to get backtrace, then we can help you. Cheers, -- Andy writes: > I reported a seg-fault in chart a while back. > > so I was experimenting with cairo and rendering to to the screen, which > if my understanding is correct, uses gtk. Certainly looks like it. > > So I compiled the cairo example Drawing.hs and that worked fine. > > I then tried running the example from ghci, i.e. loading it and typing > main. > > I get a seg-fault when it exits: > > Ok, modules loaded: Main. > *Main> main > Loading package array-0.3.0.0 ... linking ... done. > Loading package bytestring-0.9.1.5 ... linking ... done. > Loading package filepath-1.1.0.3 ... linking ... done. > Loading package old-locale-1.0.0.2 ... linking ... done. > Loading package old-time-1.0.0.3 ... linking ... done. > Loading package unix-2.4.0.0 ... linking ... done. > Loading package directory-1.0.1.0 ... linking ... done. > Loading package process-1.0.1.2 ... linking ... done. > Loading package time-1.1.4 ... linking ... done. > Loading package random-1.0.0.2 ... linking ... done. > Loading package haskell98 ... linking ... done. > Loading package mtl-1.1.0.2 ... linking ... done. > Loading package cairo-0.11.0 ... linking ... done. > Loading package containers-0.3.0.0 ... linking ... done. > Loading package glib-0.11.0 ... linking ... done. > Loading package gio-0.11.0 ... linking ... done. > Loading package pretty-1.0.1.1 ... linking ... done. > Loading package pango-0.11.0 ... linking ... done. > Loading package gtk-0.11.0 ... linking ... done. > *Main> Segmentation fault > > I included all the messages in case someone knows that one of the > libraries is out of date and could be the source of the problem. > > Is it to be expected that it would seg-fault under ghci ?? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Combining Gtk2hs and Fieldtrip
Hi Herng, You can use gtk2hs with OpenGL, then use OpenGL render your 3D graphics. You can use command cabal install install gtkglext to try it, demo at http://code.haskell.org/gtkglext/demo/ About multi-threaded, yes, you must post all *gtk* code to gtk+ main thread, otherwise bad thing will happened. But you can unsafeInitGUIForThreadedRTS with "-thread" to enable multi-thread, then use other threads calculate *non-graphics* code, and use postGUIAsync post all *gtk* code to gtk main-thread. Of course, if OpenGL still slow, perhaps algorithm problem or hardware performance problem. Cheers, -- Andy Herng Yi Cheng writes: > Recently I wrote a 3D graphics viewer using Gtk2hs and Cairo, and it works > ok, aside from the fact > that it got quite slow > when it got to displaying about 1000 polygons. It works something like this: > The three-dimensional > coordinates of polygons > are given, and the program sorts the polygons using a BSP Tree (following the > Painter's Algorithm), > then it projects the > polygons onto the plane of vision and renders each polygon to the screen > using Cairo. After some > investigation, I realised > that my bottleneck was the rendering of polygons, but I could not speed up > the rendering using > parallel programming since > the rendering order is crucial in the Painter's Algorithm. Even if I switched > to an algorithm based > on Hidden Surface > Removal so I could render all my "obscured" polygons at once, Gtk2hs "is > single threaded and its > functions cannot be called > from other threads". > > Then I heard about FieldTrip, which uses the GPU to process rendering > efficiently. I decided to > switch to using FieldTrip in > conjunction with Gtk2hs to write applications, but it doesn't seem that easy > because (i) there > doesn't seem to be any > version of GHC where Gtk2hs, Glade and Fieldtrip can work together on Windows > and (ii) unlike Cairo, > there is no Gtk2hs > support for Fieldtrip in the sense that there are no Gtk2hs functions that > render FieldTrip output > to a Gtk2hs widget, like > the DrawWindow. The latter would mean that Gtk2hs can't interact easily with > FieldTrip. > > I really like Gtk2hs because it is very comprehensive and its interface can > be designed using > Glade. Does anyone know if > there is a project linking Gtk2hs and FieldTrip? Otherwise, does anyone know > if user interfaces can > be written using > Reactive (since it's linked to FieldTrip) with the usual functionality (e.g. > menus, buttons, > FieldTrip display reacting to > mouseclicks etc)? If that is possible then I might have to switch to > Reactive, but I'd miss Glade a > lot :) > > regards, > Herng Yi > > ___ > 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] Please report any bug of gtk2hs-0.11.0!
Sebastian Fischer writes: > Hello, > > On Jul 13, 2010, at 9:15 AM, Andy Stewart wrote: > >> Please report any bug of gtk2hs-0.11.0, we will fix it before release >> gtk2hs-0.11.1 > > I have just installed the new Haskell Platform under Mac OS X 10.5. With the > previous installation > of GHC 6.10.4 I managed to install gtk2hs manually so I think I have all > required Unix libs. > > Now, I tried to install gtk2hs from Hackage but didn't succeed. > > cabal install gtk2hs-buildtools > > works fine but > > cabal install gtk > > fails with the message > > Configuring gtk-0.11.0... > setup: ./Graphics/UI/Gtk/General/IconTheme.chs: invalid argument > cabal: Error: some packages failed to install: > gtk-0.11.0 failed during the building phase. The exception was: > ExitFailure 1 > > The dependencies seem to be installed properly: > > # ghc-pkg --user list | grep 0.11.0 > cairo-0.11.0 > gio-0.11.0 > glib-0.11.0 > pango-0.11.0 > > Has anyone experienced this before? Googling the error message brings up a > related problem under > Solaris but no solution. It's a bug of gtk2hs-0.11.0, that IconTheme.chs contain some UTF-8 character that can't handle by gtk2hs/gtk/Gtk2HsSetup.hs You can fix this problem with two solutions: 1) Change your locate to UTF-8. 2) Or download darcs version of gtk2hs (darcs get http://code.haskell.org/gtk2hs). Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Problem with reloading modules in GHC API
Hongmin Fan writes: > Thanks Andy! Yes, I do need the second approach you listed here. I think the > plugin package actually > uses GHC API to load > too. > > My problem here is more technical than theoretical. The type safety isn't the > primary issue for me, > because I'm trying to > implement a certain genetic programming system (there is some papers like > this one: > http://citeseerx.ist.psu.edu/viewdoc/ > summary?doi=10.1.1.98.7686), which generates functions that I'm going to > dynamically evaluate. I'm > hoping to use GHC API to > avoid writing my own evaluator. The func generation component actually is > designed to generate > functions of the specific > type, so no worries about type safty. > > I'm looking for a clean/correct way to use GHC API to reload the module, > maybe there is some option > I should set but I > didn't? Being new to Haskell, the source code for GHCi isn't so accessible... > Thanks! If you want dynamic evaluation, you can try hint : Runtime Haskell interpreter (GHC API wrapper) At http://hackage.haskell.org/package/hint Cheers, -- Andy > > On Tue, Jul 20, 2010 at 1:01 AM, Andy Stewart > wrote: > > Hi Hongmin, > > I think you're looking for how to hot-swap Haskell program. > > There are two approach to reach target: > > 1) Source-Code level: > Recompile source code to build new execute cache file, if re-compile > successful, use executeFile to switch new entry. You perhaps need use > Binary instance to save/restore state between re-launch new execute > file. > > 2) Dynamic Linking object code. > Compile plugins code to object file, the use .o and .hi file to > dynamic linking object code to running Haskell application. > Because .hi file have type/depend information, we can do type-check > when dynamic linking .o file. > > First way is simpler, but you perhaps will lost state after reboot, > because you can't serialize state (such as FFI) sometimes. > > Second way is more complicated, but you can present all state when > hot-swapping. > > Looks you need second way, from your code, that's wrong, you can't > dynamic link object file without type-check, and expect everything will > be fine. > If you don't type-check when linking code, it's very dangerous, it willl > *crash* your > program once type mismatch or runtime error occur. > > Infact, Don Stewart has implement a complete solution to dynamic > linking in Haskell program, at > http://hackage.haskell.org/package/plugins-1.4.1 > Unfortunately, it's broken with ghc-6.12.x > > Before Don fix plugins package, i recommend you read Don's new paper > (http://www.cse.unsw.edu.au/~dons/papers/dons-phd-thesis.pdf) > You will know every detail that how to dynamic extension Haskell > program. > > Hope above will help you. :) > > -- Andy > > Hongmin Fan writes: > > > Hi, > > > > I'm using GHC API to dynamically load some module, and evaluate it; and > later change the > content of > > the module, and > > re-evaluate it. But I found unless I delete the object file created by > previous compilation, > the > > module seems not reloaded. > > I have set ghcLink = LinkInMemory as an older post suggested > > > > To illustrate what I'm saying, here is a piece of code (sorry for any > naivety in the code, new > to > > Haskell too) > > > > import System.IO (IOMode(..),hClose,hPutStr,openFile) > > import Directory (removeFile) > > import GHC > > import GHC.Paths > > import DynFlags > > import Unsafe.Coerce > > > > src_file = "Target.hs" > > obj_file = "Target.o" > > > > main = do > > writeTarget "arg" > > func0 <- compileTarget > > putStrLn $ show $ func0 2 > > > > writeTarget "arg*2" > > func1 <- compileTarget > > putStrLn $ show $ func1 2 > > > > writeTarget input = do > > -- removeFile obj_file `catch` (const $ return ()) -- uncomment this > line to have correct > results > > h <- openFile src_file WriteMode > > hPutStr h "module Target (Target.target) where\n" > > hPutStr h "target::Double -> Double\n" > > hPutStr h "t
[Haskell-cafe] Re: Problem with reloading modules in GHC API
Hi Hongmin, I think you're looking for how to hot-swap Haskell program. There are two approach to reach target: 1) Source-Code level: Recompile source code to build new execute cache file, if re-compile successful, use executeFile to switch new entry. You perhaps need use Binary instance to save/restore state between re-launch new execute file. 2) Dynamic Linking object code. Compile plugins code to object file, the use .o and .hi file to dynamic linking object code to running Haskell application. Because .hi file have type/depend information, we can do type-check when dynamic linking .o file. First way is simpler, but you perhaps will lost state after reboot, because you can't serialize state (such as FFI) sometimes. Second way is more complicated, but you can present all state when hot-swapping. Looks you need second way, from your code, that's wrong, you can't dynamic link object file without type-check, and expect everything will be fine. If you don't type-check when linking code, it's very dangerous, it willl *crash* your program once type mismatch or runtime error occur. Infact, Don Stewart has implement a complete solution to dynamic linking in Haskell program, at http://hackage.haskell.org/package/plugins-1.4.1 Unfortunately, it's broken with ghc-6.12.x Before Don fix plugins package, i recommend you read Don's new paper (http://www.cse.unsw.edu.au/~dons/papers/dons-phd-thesis.pdf) You will know every detail that how to dynamic extension Haskell program. Hope above will help you. :) -- Andy Hongmin Fan writes: > Hi, > > I'm using GHC API to dynamically load some module, and evaluate it; and later > change the content of > the module, and > re-evaluate it. But I found unless I delete the object file created by > previous compilation, the > module seems not reloaded. > I have set ghcLink = LinkInMemory as an older post suggested > > To illustrate what I'm saying, here is a piece of code (sorry for any naivety > in the code, new to > Haskell too) > > import System.IO (IOMode(..),hClose,hPutStr,openFile) > import Directory (removeFile) > import GHC > import GHC.Paths > import DynFlags > import Unsafe.Coerce > > src_file = "Target.hs" > obj_file = "Target.o" > > main = do > writeTarget "arg" > func0 <- compileTarget > putStrLn $ show $ func0 2 > > writeTarget "arg*2" > func1 <- compileTarget > putStrLn $ show $ func1 2 > > writeTarget input = do > -- removeFile obj_file `catch` (const $ return ()) -- uncomment this line > to have correct results > h <- openFile src_file WriteMode > hPutStr h "module Target (Target.target) where\n" > hPutStr h "target::Double -> Double\n" > hPutStr h "target arg = \n " > hPutStr h input > hClose h > > compileTarget = > defaultErrorHandler defaultDynFlags $ do > func <- runGhc (Just libdir) $ do > -- setup dynflags > dflags <- getSessionDynFlags > setSessionDynFlags dflags { ghcLink = LinkInMemory } > > -- load target module > target <- guessTarget src_file Nothing > setTargets [target] > r <- load LoadAllTargets > case r of > Failed -> error "Compilation failed" > Succeeded -> do > m <- findModule (mkModuleName "Target") Nothing > -- set context and compile > setContext [] [m] > value <- compileExpr ("Target.target") > do > let value' = (unsafeCoerce value) :: Double -> Double > return value' > return func > > The code basically write to a Haskell source file twice with different > content, and hoping to get > different results, but > unless I uncomment the line with removeFile, the output of 2 runs are the > same; using 'touch' to > touch the source file being > written between 2 runs also gives the correct results. So maybe caused by > some caching mechanism? > > I'm using GHC 6.12.1 in Ubuntu 10.04. I have this workaround of deleting the > obj file, but I'm > wondering the "correct" way > of doing it. Did some search on GHC API, but never got something relevant. > > Thanks, > Hongmin > > ___ > 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] Re: qtHaskell
Hi Ali, Ali Razavi writes: > Greetings, > I have only used the wxHaskell library before, but I am looking into trying > one of these more > advanced' frameworks. To > serve my proclivity for QT, I would like to know how its Haskell binding, > qtHaskell, compares to > that of Gtk. If you just want a GUI toolkit for Haskell, and don't care QT or GTK+. I recommend use gtk2hs. Now, qtHaskell's development looks not open enough, still have many Qt binding haven't finish. And gtk2hs is more mature and stable, most important is gtk2hs have friendly developer will help you in anytime. :) Of course, if just want to use QT, qtHaskell is right choose. :) Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
Bartek Ćwikłowski writes: > Hello Andy, > > 2010/7/16 Andy Stewart : > >> There are some problems with re-compile solution: >> >> 1) You can't save *all* state with some FFI code, such as gtk2hs, you >> can't save state of GTK+ widget. You will lost some state after >> re-launch new entry. > > For my 2008 GSOC application I wrote a demo app that used hot code > reloading and it maintained gtk state just fine. The code (and video) > is available at http://paczesiowa.dw.pl/ , it worked in ghc 6.8 and > needed hs-plugins, so it won't work now, but the approach should work. Wow, thanks for your hint, i will wait dons fix hs-plugins then try this cool feature.. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hot-Swap with Haskell
Thomas Schilling writes: > What would be the semantics of hot-swapping? For, example, somewhere > in memory you have a thunk of expression e. Now the user wants to > upgrade e to e'. Would you require all thunks to be modified? A > similar problem occurs with stack frames. > > You'd also have to make sure that e and e' have the same (or > compatible types). e' most likely has different free variables than > e, how can you translate thunk one to the other? > > Now assuming you don't try to do this, how would you handle the case > when something goes wrong? Good question. Infact, currently, i just use same technology with Yi/XMonad. Re-compile modules, and save some initial state before re-launch, and do re-execute some command to re-store those state after re-launch. Re-compile will drop old code, and restore state in new code. But re-compile solution not neat way since some state will lost. About your "upgrade expression" question, i haven no answer, that's why i post this topic to looking for a better solution. I know Emacs use some "indirection symbol table" for hot-swapping, but it's not safe since it not do type-check. Maybe we can wrap 'Dynamic' check type for safe re-load in runtime, if type match then upgrade, otherwise stop upgrade and keep old state. I just test re-compile technology, not try dynamic linking/load technology that Dons introduce in "Plugging Haskell In.pdf" since 'plugins' package is broken at the moment. Anyway, i believe this have a neat way to make static typing language can extension dynamic. Now, i'm reading Dons' new paper "Dynamic Extension of Typed Functional Languages" (http://www.cse.unsw.edu.au/~dons/papers/dons-phd-thesis.pdf) I hope i can find answer after read this paper... Any discuss are welcome! -- Andy >> > On 16 July 2010 04:05, Andy Stewart wrote: >> Hi all, >> >> I'm research to build a hot-swap Haskell program to developing itself in >> Runtime, like Emacs. >> >> Essentially, Yi/Xmonad/dyre solution is "replace currently executing" >> technology: >> >> re-compile new code with new binary entry >> >> when re-compile success >> $ do >> save state before re-launch new entry >> replace current entry with new binary entry (executeFile) >> store state after re-launch new entry >> >> There are some problems with re-compile solution: >> >> 1) You can't save *all* state with some FFI code, such as gtk2hs, you >> can't save state of GTK+ widget. You will lost some state after >> re-launch new entry. >> >> 2) Sometimes re-execute is un-acceptable, example, you running some command >> in temrinal before you re-compile, you need re-execute command to >> restore state after re-launch, in this situation re-execute command is >> un-acceptable. >> >> I wonder have a better way that hot-swapping new code without >> re-compile/reboot. >> >> Thanks, >> >> -- Andy >> >> ___ >> 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] Re: Hot-Swap with Haskell
Martin Hilbig writes: > hi, > > if been thinking about an haskell interpreter to, because of erlang's otp. > its syntax is a mess, but > its scalability is win. > > since erlang runs in its vm ("interpreted") is there a need for a real > haskell interpreter, or can > there be a compiled haskell/otp with hotswapping, scaling and stuff? > > now back on topic, i wrote "real" haskell interpreter because there is the > hint[1] package, which > wrappes the ghc api. > > now i dont know what more the plugin package provides, but i thought hint is > like is successor > (since lambdabot used plugins and now uses mueval, which in turn uses hint > ;). please correct me. Yes, "haskell interpreter" maybe is solution, because Emacs is use this solution: "Static C core ++ elisp interpreter", then all elisp hot-swapping is base on elisp interpreter. IMO, "haskell interpreter" is perfect solution for samll script job. But i'm afraid "haskell interpreter" is slow for *large code*, i don't know, i haven't try this way... Thanks for your suggestion, i will consider it. -- Andy > > have fun > martin > > [1]: http://hackage.haskell.org/package/hint > > On 16.07.2010 06:06, Andy Stewart wrote: >> Don Stewart writes: >> >>> lazycat.manatee: >>>> Hi all, >>>> >>>> I'm research to build a hot-swap Haskell program to developing itself in >>>> Runtime, like Emacs. >>>> >>>> Essentially, Yi/Xmonad/dyre solution is "replace currently executing" >>>> technology: >>>> >>>> re-compile new code with new binary entry >>>> >>>> when re-compile success >>>>$ do >>>>save state before re-launch new entry >>>>replace current entry with new binary entry (executeFile) >>>>store state after re-launch new entry >>>> >>>> There are some problems with re-compile solution: >>>> >>>> 1) You can't save *all* state with some FFI code, such as gtk2hs, you >>>> can't save state of GTK+ widget. You will lost some state after >>>> re-launch new entry. >>>> >>>> 2) Sometimes re-execute is un-acceptable, example, you running some command >>>> in temrinal before you re-compile, you need re-execute command to >>>> restore state after re-launch, in this situation re-execute command is >>>> un-acceptable. >>>> >>>> I wonder have a better way that hot-swapping new code without >>>> re-compile/reboot. >>>> >>> >>> Well, the other approach to reloadable modules, using either object code >>> plugins, or bytecode plugins, giving you module-level granularity. >> Thanks for your reply. >> >> I have read your papers : "Dynamic Application From the Group Up" and >> "Plugging Haskell In" >> >> In "Dynamic Application From the Group Up", you introduction how to use >> re-compile technology implement source-code level hot-swapping. >> >> In "Plugging Haskell In", you introduction to how to buld hot-swapping >> with object-code level. >> >> Yes, Dynamic linking can add new code to a running program, but how to >> replace existing binding with new ones? >> Looks you still need some reboot when you do *replace* and not just *add*. >> >> Infact, reboot is okay, only problem is *keep state*, some *static state* >> is easier to re-build, example, if you want restore editor buffer state, you >> just need save (filepath, cursorPosition), you can re-open file and >> restore cursor position after reboot process. >> >> Difficult is *Stream State*, such as: >>delete operation in file-manager >>command running in temrinal >>network communications in browser >> It's really difficult to restore those state, and re-execute is >> un-acceptable sometimes. >> >> You can found the screenshot of my project at >> http://www.flickr.com/photos/48809...@n02/ >> >> Currently, the closest library to implement dynamic linking is your >> plugins package (http://hackage.haskell.org/package/plugins-1.4.1), >> i really want to write some code to test it, unfortunately, it's >> broken with Cabal-1.8.0.4 that can't compile with ghc-6.12.x/ghc-6.12.3, >> can you fix it if you have time? It's so great package... >> >> I'm looking for some paper about "Haskell and hot-swapping". >> Any paper or suggestion are welcome! >> >>-- Andy >> >> >> >> >> >> ___ >> 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] Re: Hot-Swap with Haskell
Don Stewart writes: > lazycat.manatee: >> Hi all, >> >> I'm research to build a hot-swap Haskell program to developing itself in >> Runtime, like Emacs. >> >> Essentially, Yi/Xmonad/dyre solution is "replace currently executing" >> technology: >> >>re-compile new code with new binary entry >> >>when re-compile success >> $ do >> save state before re-launch new entry >> replace current entry with new binary entry (executeFile) >> store state after re-launch new entry >> >> There are some problems with re-compile solution: >> >> 1) You can't save *all* state with some FFI code, such as gtk2hs, you >> can't save state of GTK+ widget. You will lost some state after >> re-launch new entry. >> >> 2) Sometimes re-execute is un-acceptable, example, you running some command >> in temrinal before you re-compile, you need re-execute command to >> restore state after re-launch, in this situation re-execute command is >> un-acceptable. >> >> I wonder have a better way that hot-swapping new code without >> re-compile/reboot. >> > > Well, the other approach to reloadable modules, using either object code > plugins, or bytecode plugins, giving you module-level granularity. Thanks for your reply. I have read your papers : "Dynamic Application From the Group Up" and "Plugging Haskell In" In "Dynamic Application From the Group Up", you introduction how to use re-compile technology implement source-code level hot-swapping. In "Plugging Haskell In", you introduction to how to buld hot-swapping with object-code level. Yes, Dynamic linking can add new code to a running program, but how to replace existing binding with new ones? Looks you still need some reboot when you do *replace* and not just *add*. Infact, reboot is okay, only problem is *keep state*, some *static state* is easier to re-build, example, if you want restore editor buffer state, you just need save (filepath, cursorPosition), you can re-open file and restore cursor position after reboot process. Difficult is *Stream State*, such as: delete operation in file-manager command running in temrinal network communications in browser It's really difficult to restore those state, and re-execute is un-acceptable sometimes. You can found the screenshot of my project at http://www.flickr.com/photos/48809...@n02/ Currently, the closest library to implement dynamic linking is your plugins package (http://hackage.haskell.org/package/plugins-1.4.1), i really want to write some code to test it, unfortunately, it's broken with Cabal-1.8.0.4 that can't compile with ghc-6.12.x/ghc-6.12.3, can you fix it if you have time? It's so great package... I'm looking for some paper about "Haskell and hot-swapping". Any paper or suggestion are welcome! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hot-Swap with Haskell
Hi all, I'm research to build a hot-swap Haskell program to developing itself in Runtime, like Emacs. Essentially, Yi/Xmonad/dyre solution is "replace currently executing" technology: re-compile new code with new binary entry when re-compile success $ do save state before re-launch new entry replace current entry with new binary entry (executeFile) store state after re-launch new entry There are some problems with re-compile solution: 1) You can't save *all* state with some FFI code, such as gtk2hs, you can't save state of GTK+ widget. You will lost some state after re-launch new entry. 2) Sometimes re-execute is un-acceptable, example, you running some command in temrinal before you re-compile, you need re-execute command to restore state after re-launch, in this situation re-execute command is un-acceptable. I wonder have a better way that hot-swapping new code without re-compile/reboot. Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Please report any bug of gtk2hs-0.11.0!
writes: > Short version of this post: > > Looks like the intsall depends on alex and that dependencies doesn't > appear to be handled, i.e. I had to install alex before proceeding. > > why do is it called gtk2hs if you are actually installing package > gtk ;-) Because before gtk2hs cabalized package release (gtk2hs-0.11.0), we put many gtk+ base package in *one* repository. Currently, glib, gio, cairo, pango, gtk still in repository : http://code.haskell.org/gtk2hs > > Where's the demo directory ?! Sorry, we forgot add demo in .cabal file when we released gtk2hs-0.11.0, We will include all demos in gtk2hs-0.11.1 > > Moral of the story: don't forget to install -dev version of the > necessary libraries. For me that was libpango1.0-dev, libgtk2.0-dev and > libglib2.0-dev. > > The long version: > > I have a debian system and I expect the problems I found to be > relatively common. Hope this is useful. > > First I found that I needed package alex. > > then i was able to > > cabal install gtk2hs-buildtools > > however > > cabal install gtk > > didn't work: > > Configuring glib-0.11.0... > setup: The pkg-config package glib-2.0 is required but it could not be > found. cabal: Error: some packages failed to install: > gio-0.11.0 depends on glib-0.11.0 which failed to install. > glib-0.11.0 failed during the configure step. The exception was: > ExitFailure 1 > gtk-0.11.0 depends on glib-0.11.0 which failed to install. > pango-0.11.0 depends on glib-0.11.0 which failed to install. > > cabal install glib > > Configuring glib-0.11.0... > setup: The pkg-config package glib-2.0 is required but it could not be > found. cabal: Error: some packages failed to install: > glib-0.11.0 failed during the configure step. The exception was: > ExitFailure 1 > > now it's not obvious to me at this point if it's referencing a cabal > package glib-2.0 or the unix libs. But I'm going to guess it's > actually the unix libs. > > I do have the unix libs installed : > > ii libglib2.0-0 > 2.24.1-1 The GLib library of C routines > > However I remembered that annoying little thing that there is always > those darn -dev versions of the lib that you need when you actually > want to compile against libraries. So I installed it and got farther > along, crashing on pango. > > Turns out it's the same problem. So install libpango1.0-dev and > continue... > > Stopped again on gtk+, aka gtk libgtk2.0-dev. Installed it, and > trudged on. > > I noticed that the install process stays at this point for a long > time: > > Preprocessing library gtk-0.11.0... > > But it does eventually continue, and it even completes successfully ! > > Strangely, at this point, I find that I don't know that I actually have > gtk2hs installed. I know that this sound kinda dumb, but I just did > "cabal install gtk", right ? I immediately tried "cabal install > gtk2hs", which said no such library, and realized that gtk was it :-) > > So I'd like to run a demo to make sure things are installed properly. > > Running the demos. > -- > > To get started, you can compile and run one of the programs that reside > in the demo/ directory in the respective packages. For example: > > ~/gtk2hs/gtk/demo/hello:$ make > > > But after the installation the demo directory is nowhere to be found. > Do you need to pull it in with darcs ?? > > > Brian > > On Tue, 13 Jul 2010 11:42:26 +0200 > Christian Maeder wrote: > >> Andy Stewart schrieb: >> > Hi all, >> > >> > We plan to release bug fix version : gtk2hs-0.11.1 >> > >> > Please report any bug of gtk2hs-0.11.0, we will fix it before >> > release gtk2hs-0.11.1 >> >> I'm looking forward for this bug-fix release (since gtk2hs-0.11.0 did >> not work for me). >> >> Because I've almost missed this message I reply to >> gtk2hs-us...@lists.sourceforge.net, too. >> >> Christian >> >> > >> > We plan to add many new APIs in gtk2hs-0.12.0, >> > so gtk2hs-0.11.1 will be the last stable version with current APIs. >> > >> > Thanks for your help! >> > >> > -- Andy >> ___ >> 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] Please report any bug of gtk2hs-0.11.0!
Hi all, We plan to release bug fix version : gtk2hs-0.11.1 Please report any bug of gtk2hs-0.11.0, we will fix it before release gtk2hs-0.11.1 We plan to add many new APIs in gtk2hs-0.12.0, so gtk2hs-0.11.1 will be the last stable version with current APIs. Thanks for your help! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ghc-6.12 can't works with Cabal-1.8.0.4?
Hi all, I upload package http://hackage.haskell.org/package/poppler-0.11.1 I can compile it on my box, but it build failure at hackage with below error: --> error start <-- *** setup configure Reading installed packages... /usr/local/bin/ghc-pkg dump --global /usr/local/bin/ghc-pkg dump --user /usr/local/bin/ghc --print-libdir Creating setup (and its parents) /usr/local/bin/ghc -package Cabal-1.8.0.4 --make Setup.hs -o setup/setup -odir setup -hidir setup : cannot satisfy -package Cabal-1.8.0.4 (use -v for more information) *** Trying again with preferred-versions *** setup configure Reading installed packages... /usr/local/bin/ghc-pkg dump --global /usr/local/bin/ghc-pkg dump --user /usr/local/bin/ghc --print-libdir Creating setup (and its parents) /usr/local/bin/ghc -package Cabal-1.8.0.4 --make Setup.hs -o setup/setup -odir setup -hidir setup : cannot satisfy -package Cabal-1.8.0.4 (use -v for more information) --> error end <-- My poppler.cabal is --> poppler.cabal start <-- Name: poppler Version:0.11.1 License:GPL-2 License-file: COPYING Copyright: (c) 2001-2010 The Gtk2Hs Team Author: Andy Stewart Maintainer: gtk2hs-us...@sourceforge.net Build-Type: Custom Cabal-Version: >= 1.6 Stability: stable homepage: http://www.haskell.org/gtk2hs/ bug-reports:http://hackage.haskell.org/trac/gtk2hs/ Synopsis: Binding to the Poppler. Description:Poppler is a fork of the xpdf PDF viewer, to provide PDF rendering functionality as a shared library, to centralize the maintenance effort. And move to forward in a number of areas that don't fit within the goals of xpdf. Category: Graphics Tested-With:GHC == 6.12.3 Extra-Source-Files: Gtk2HsSetup.hs hierarchy.list template-hsc-gtk2hs.h x-Types-File: Graphics/UI/Gtk/Poppler/Types.chs x-Types-ModName: Graphics.UI.Gtk.Poppler.Types x-Types-Import:System.Glib.GObject x-Types-Lib: poppler x-Types-Prefix:poppler x-Types-Tag: poppler x-Types-Hierarchy: hierarchy.list Data-Dir: demo Data-Files: PdfViewer.hs Makefile Source-Repository head type: darcs location: http://patch-tag.com/r/AndyStewart/poppler Library build-depends: base >= 4 && < 5, array, containers, haskell98, mtl, bytestring, glib >= 0.11 && < 0.12, cairo >= 0.11 && < 0.12, gtk >= 0.11 && < 0.12 build-tools:gtk2hsC2hs, gtk2hsHookGenerator, gtk2hsTypeGen exposed-modules: Graphics.UI.Gtk.Poppler.Action Graphics.UI.Gtk.Poppler.Attachment Graphics.UI.Gtk.Poppler.Document Graphics.UI.Gtk.Poppler.FormField Graphics.UI.Gtk.Poppler.Layer Graphics.UI.Gtk.Poppler.Page Graphics.UI.Gtk.Poppler.Poppler other-modules: Graphics.UI.Gtk.Poppler.Enums Graphics.UI.Gtk.Poppler.Structs Graphics.UI.Gtk.Poppler.Types extensions: ForeignFunctionInterface include-dirs: . x-c2hs-Header: glib/poppler.h pkgconfig-depends: poppler-glib >= 0.12.4, gobject-2.0, glib-2.0, cairo >= 1.2.0, gdk-2.0, gdk-pixbuf-2.0, pango --> poppler.cabal end <-- Something is wrong? Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Fix plugins package.
Yuras Shumovich writes: >> >> I got another error: >> --> error start <-- >> [ 8 of 15] Compiling System.MkTemp ( src/System/MkTemp.hs, >> dist/build/System/MkTemp.o ) >> >> src/System/MkTemp.hs:214:26: >> Couldn't match expected type `IOError' >> against inferred type `Maybe FilePath -> IOException' >> In the first argument of `ioError', namely `err' >> In the expression: ioError err >> In the expression: >> if b then ioError err else openFile f ReadWriteMode >> cabal: Error: some packages failed to install: >> plugins-1.4.1 failed during the building phase. The exception was: >> ExitFailure 1 >> --> error end <-- > > I checked out sources and tried it myself. You need: > > [mkTemp:217] err = IOError Nothing AlreadyExists "open0600" "already > exists" Nothing Nothing > > if you will get error in readBinIface', then > [Load.hs:725] e <- newHscEnv undefined undefined > > if you will get error in loadFunction__, then > [Load.hs: 441] ptr@(Ptr addr) <- withCString symbol c_lookupSymbol > > It should compile now, but I don't know will it work or no. Thanks for your time and help. I think best to let author fix those problem. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Fix plugins package.
Yuras Shumovich writes: >> Another error : >> >> --> error start <-- >> Preprocessing library plugins-1.4.1... >> Building plugins-1.4.1... >> [ 7 of 15] Compiling System.Plugins.Env ( src/System/Plugins/Env.hs, > dist/build/System/Plugins/Env.o ) >> >> src/System/Plugins/Env.hs:315:45: >> Couldn't match expected type `PackageDBStack' >> against inferred type `PackageDB' >> In the second argument of `getInstalledPackages', namely >> `(SpecificPackageDB f)' >> In a stmt of a 'do' expression: >> pkgIndex <- getInstalledPackages silent (SpecificPackageDB f) pc >> In the expression: >> do { pc <- configureAllKnownPrograms >> silent defaultProgramConfiguration; >> pkgIndex <- getInstalledPackages silent (SpecificPackageDB f) pc; >> return $ allPackages pkgIndex } >> cabal: Error: some packages failed to install: >> plugins-1.4.1 failed during the building phase. The exception was: >> ExitFailure 1 >> --> error end <-- > > It looks like it is not the last error :) Yes, it's not last error. :) I got another error: --> error start <-- [ 8 of 15] Compiling System.MkTemp( src/System/MkTemp.hs, dist/build/System/MkTemp.o ) src/System/MkTemp.hs:214:26: Couldn't match expected type `IOError' against inferred type `Maybe FilePath -> IOException' In the first argument of `ioError', namely `err' In the expression: ioError err In the expression: if b then ioError err else openFile f ReadWriteMode cabal: Error: some packages failed to install: plugins-1.4.1 failed during the building phase. The exception was: ExitFailure 1 --> error end <-- Thank you very much help me so far. I hope Don can taking some time to fix those problems. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Fix plugins package.
Yuras Shumovich writes: >>> src/System/Plugins/Process.hs:59:4: >>> Warning: A do-notation statement discarded a result of type >>> GHC.Conc.ThreadId. >>> Suppress this warning by saying "_ <- forkIO >>> ((>>) >>> E.evaluate (length >>> errput) >>> return >>> GHC.Unit.())", >>> or by using the flag -fno-warn-unused-do-bind >>> [ 3 of 15] Compiling System.Plugins.Parser ( src/System/Plugins/Parser.hs, >>> dist/build/System/Plugins/Parser.o ) >>> >>> src/System/Plugins/Parser.hs:31:0: >>> Warning: The import of `Data.Either' is redundant >>> except perhaps to import instances from `Data.Either' >>> To import instances alone, use: import Data.Either() >>> [ 4 of 15] Compiling System.Plugins.PackageAPI ( >>> src/System/Plugins/PackageAPI.hs, >>> dist/build/System/Plugins/PackageAPI.o ) >>> >>> src/System/Plugins/PackageAPI.hs:61:24: Not in scope: `package' >>> >>> src/System/Plugins/PackageAPI.hs:62:25: Not in scope: `package' >>> ... > > You can just replace 'package' with 'sourcePackageId' After replace 'package' with 'sourcePackageId' Another error : --> error start <-- Preprocessing library plugins-1.4.1... Building plugins-1.4.1... [ 7 of 15] Compiling System.Plugins.Env ( src/System/Plugins/Env.hs, dist/build/System/Plugins/Env.o ) src/System/Plugins/Env.hs:315:45: Couldn't match expected type `PackageDBStack' against inferred type `PackageDB' In the second argument of `getInstalledPackages', namely `(SpecificPackageDB f)' In a stmt of a 'do' expression: pkgIndex <- getInstalledPackages silent (SpecificPackageDB f) pc In the expression: do { pc <- configureAllKnownPrograms silent defaultProgramConfiguration; pkgIndex <- getInstalledPackages silent (SpecificPackageDB f) pc; return $ allPackages pkgIndex } cabal: Error: some packages failed to install: plugins-1.4.1 failed during the building phase. The exception was: ExitFailure 1 --> error end <-- Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Fix plugins package.
Andy Stewart writes: > Hi Ivan, > > Ivan Lazar Miljenovic writes: > >> Andy Stewart writes: >> >>> Hi all, >>> >>> I want to use *plugins* package >>> (http://hackage.haskell.org/package/plugins-1.4.1) >>> >>> Unfortunately, it looks broken. >>> Anybody can fix it? >> >> Try putting an upper bound in the constraint for `base'; since there's >> no upper bound, cabal-install defaults to "< 4", which conflicts with >> plugins _needing_ base >= 4. > I think not just build-depend problem, something broken in plugins > source code, below is compile error: > > > src/System/Plugins/Process.hs:59:4: > Warning: A do-notation statement discarded a result of type > GHC.Conc.ThreadId. > Suppress this warning by saying "_ <- forkIO > ((>>) > E.evaluate (length > errput) > return GHC.Unit.())", > or by using the flag -fno-warn-unused-do-bind > [ 3 of 15] Compiling System.Plugins.Parser ( src/System/Plugins/Parser.hs, > dist/build/System/Plugins/Parser.o ) > > src/System/Plugins/Parser.hs:31:0: > Warning: The import of `Data.Either' is redundant >except perhaps to import instances from `Data.Either' > To import instances alone, use: import Data.Either() > [ 4 of 15] Compiling System.Plugins.PackageAPI ( > src/System/Plugins/PackageAPI.hs, > dist/build/System/Plugins/PackageAPI.o ) > > src/System/Plugins/PackageAPI.hs:61:24: Not in scope: `package' > > src/System/Plugins/PackageAPI.hs:62:25: Not in scope: `package' > ... Looks plugins just work on base-4 and Cabal-1.6. Anyone can fix it make it works with Cabal-1.8? Thanks, -- Andy > >> >> The hint library might also do what you want: >> http://hackage.haskell.org/package/hint > Wow, i didn't know it. > > Infact, i want implement a *fully* hot-swapping feature for Haskell > application, not just > re-compile/re-load module in runtime like Yi/Xmonad, i have code do that. > I want to a Haskell interpreter to evaluation expression/module in > runtime, then application can develop itself in runtime, don't need > restart. > > hint library looks interesting. > > Thanks for hint link. > > -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fix plugins package.
Hi Ivan, Ivan Lazar Miljenovic writes: > Andy Stewart writes: > >> Hi all, >> >> I want to use *plugins* package >> (http://hackage.haskell.org/package/plugins-1.4.1) >> >> Unfortunately, it looks broken. >> Anybody can fix it? > > Try putting an upper bound in the constraint for `base'; since there's > no upper bound, cabal-install defaults to "< 4", which conflicts with > plugins _needing_ base >= 4. I think not just build-depend problem, something broken in plugins source code, below is compile error: --> error start <-- src/System/Plugins/Process.hs:59:4: Warning: A do-notation statement discarded a result of type GHC.Conc.ThreadId. Suppress this warning by saying "_ <- forkIO ((>>) E.evaluate (length errput) return GHC.Unit.())", or by using the flag -fno-warn-unused-do-bind [ 3 of 15] Compiling System.Plugins.Parser ( src/System/Plugins/Parser.hs, dist/build/System/Plugins/Parser.o ) src/System/Plugins/Parser.hs:31:0: Warning: The import of `Data.Either' is redundant except perhaps to import instances from `Data.Either' To import instances alone, use: import Data.Either() [ 4 of 15] Compiling System.Plugins.PackageAPI ( src/System/Plugins/PackageAPI.hs, dist/build/System/Plugins/PackageAPI.o ) src/System/Plugins/PackageAPI.hs:61:24: Not in scope: `package' src/System/Plugins/PackageAPI.hs:62:25: Not in scope: `package' ... --> error end <-- > > The hint library might also do what you want: > http://hackage.haskell.org/package/hint Wow, i didn't know it. Infact, i want implement a *fully* hot-swapping feature for Haskell application, not just re-compile/re-load module in runtime like Yi/Xmonad, i have code do that. I want to a Haskell interpreter to evaluation expression/module in runtime, then application can develop itself in runtime, don't need restart. hint library looks interesting. Thanks for hint link. -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fix plugins package.
Hi all, I want to use *plugins* package (http://hackage.haskell.org/package/plugins-1.4.1) Unfortunately, it looks broken. Anybody can fix it? Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Read Instance code.
Andy Stewart writes: > Ivan Lazar Miljenovic writes: > >> Andy Stewart writes: >> >>> Hi all, >>> >>> I have some incorrect "Read instance" make i got error "Prelude.read: no >>> parse", and i don't know how to fix it. >>> >>> >>> newtype SerializedWindow = SerializedWindow (Maybe DrawWindow) >>> >>> instance Show SerializedWindow where >>> show _ = "SerializedWindow Nothing" >>> >>> instance Read SerializedWindow where >>> readsPrec _ str = [(SerializedWindow Nothing, idStr) >>>| (val :: String, idStr) <- reads str] >> >> Try using Derive or DrIFT to generate a proto-typical instance for you, >> and then hack that and make it neater. If you don't care about >> cross-compiler compatability, using ReadP rather than ReadS also results >> in nicer parsing code. No matter, i found better way: Just skip ForeginPtr value when i do Show, then i use "SerializedWindow Nothing" fill in Read instance. -- Andy > Sorry, i haven't explain my situation. > > I'm try to serialized/derserialized Gtk+ Event C struct over the network. > > Since DrawWindow is ForeignPtr to point C structure, and "deriving Read" > nothing help. > > So i want build a "bogus value" -- "SerializedWindow Nothing" to fill > DrawWindow pointer field. > > I just want got "SerializedWindow Nothing" and don't care the value > that return by *reads*. > > Below are C struct that i want to serialized with Haskell data-type: > typedef struct { > GdkEventType type; > GdkWindow *window; > gint8 send_event; > guint32 time; > guint state; > guint keyval; > gint length; > gchar *string; > guint16 hardware_keycode; > guint8 group; > guint is_modifier : 1; > } GdkEventKey; > > Below are my C binding that explain my purpose: > > {-# LANGUAGE ScopedTypeVariables #-} > -- -*-haskell-*- > > #include > #include "template-hsc-gtk2hs.h" > > -- GIMP Toolkit (GTK) GDK Serializabled Event > -- > -- Author : Andy Stewart > -- > -- Created: 01 Jul 2010 > -- > -- Copyright (C) 2010 Andy Stewart > -- > -- This library is free software; you can redistribute it and/or > -- modify it under the terms of the GNU Lesser General Public > -- License as published by the Free Software Foundation; either > -- version 2.1 of the License, or (at your option) any later version. > -- > -- This library is distributed in the hope that it will be useful, > -- but WITHOUT ANY WARRANTY; without even the implied warranty of > -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > -- Lesser General Public License for more details. > -- > -- | > -- Maintainer : gtk2hs-use...@lists.sourceforge.net > -- Stability : deprecated > -- Portability : portable (depends on GHC) > -- > module Graphics.UI.Gtk.Gdk.SerializedEvent ( > -- * Types > SerializedEventKey (..), > > -- * Methods > serializedEvent, > deserializeEventKey, > ) where > > import Control.Monad.Reader (ReaderT, ask, runReaderT ) > import Control.Monad.Trans (liftIO) > import Data.Maybe > import Data.Ord > import Graphics.UI.Gtk.Gdk.DrawWindow > import Graphics.UI.Gtk.Gdk.EventM > import Graphics.UI.Gtk.Gdk.Keys (KeyVal) > import Graphics.UI.GtkInternals > import System.Glib.FFI > import System.Glib.Flags > > data SerializedEventKey = > SerializedEventKey {sEventType :: Int >,sEventWindow:: SerializedWindow >,sEventSent :: Bool >,sEventTime :: Word32 >,sEventState :: Int >,sEventKeyval:: KeyVal >,sEventLength:: Int >,sEventString:: String >,sEventKeycode :: Word16 >,sEventGroup :: Word8 >,sEventIsModifier:: Int} > deriving (Show, Eq, Ord, Read) > > newtype SerializedWindow = SerializedWindow (Maybe DrawWindow) > > instance Eq SerializedWindow where > (==) _ _ = True > > instance Ord SerializedWindow where > compare _ _ = EQ > > instance Show SerializedWindow where > show _ = "SerializedWindow Nothing" > > instance Read SerializedWindow wh
[Haskell-cafe] Re: Read Instance code.
Ivan Lazar Miljenovic writes: > Andy Stewart writes: > >> Hi all, >> >> I have some incorrect "Read instance" make i got error "Prelude.read: no >> parse", and i don't know how to fix it. >> >> >> newtype SerializedWindow = SerializedWindow (Maybe DrawWindow) >> >> instance Show SerializedWindow where >> show _ = "SerializedWindow Nothing" >> >> instance Read SerializedWindow where >> readsPrec _ str = [(SerializedWindow Nothing, idStr) >>| (val :: String, idStr) <- reads str] > > Try using Derive or DrIFT to generate a proto-typical instance for you, > and then hack that and make it neater. If you don't care about > cross-compiler compatability, using ReadP rather than ReadS also results > in nicer parsing code. Sorry, i haven't explain my situation. I'm try to serialized/derserialized Gtk+ Event C struct over the network. Since DrawWindow is ForeignPtr to point C structure, and "deriving Read" nothing help. So i want build a "bogus value" -- "SerializedWindow Nothing" to fill DrawWindow pointer field. I just want got "SerializedWindow Nothing" and don't care the value that return by *reads*. Below are C struct that i want to serialized with Haskell data-type: typedef struct { GdkEventType type; GdkWindow *window; gint8 send_event; guint32 time; guint state; guint keyval; gint length; gchar *string; guint16 hardware_keycode; guint8 group; guint is_modifier : 1; } GdkEventKey; Below are my C binding that explain my purpose: --> C binding start <-- {-# LANGUAGE ScopedTypeVariables #-} -- -*-haskell-*- #include #include "template-hsc-gtk2hs.h" -- GIMP Toolkit (GTK) GDK Serializabled Event -- -- Author : Andy Stewart -- -- Created: 01 Jul 2010 -- -- Copyright (C) 2010 Andy Stewart -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- | -- Maintainer : gtk2hs-use...@lists.sourceforge.net -- Stability : deprecated -- Portability : portable (depends on GHC) -- module Graphics.UI.Gtk.Gdk.SerializedEvent ( -- * Types SerializedEventKey (..), -- * Methods serializedEvent, deserializeEventKey, ) where import Control.Monad.Reader (ReaderT, ask, runReaderT ) import Control.Monad.Trans (liftIO) import Data.Maybe import Data.Ord import Graphics.UI.Gtk.Gdk.DrawWindow import Graphics.UI.Gtk.Gdk.EventM import Graphics.UI.Gtk.Gdk.Keys (KeyVal) import Graphics.UI.GtkInternals import System.Glib.FFI import System.Glib.Flags data SerializedEventKey = SerializedEventKey {sEventType :: Int ,sEventWindow:: SerializedWindow ,sEventSent :: Bool ,sEventTime :: Word32 ,sEventState :: Int ,sEventKeyval:: KeyVal ,sEventLength:: Int ,sEventString:: String ,sEventKeycode :: Word16 ,sEventGroup :: Word8 ,sEventIsModifier:: Int} deriving (Show, Eq, Ord, Read) newtype SerializedWindow = SerializedWindow (Maybe DrawWindow) instance Eq SerializedWindow where (==) _ _ = True instance Ord SerializedWindow where compare _ _ = EQ instance Show SerializedWindow where show _ = "SerializedWindow Nothing" instance Read SerializedWindow where readsPrec _ str = [(SerializedWindow Nothing, idStr) | (val :: String, idStr) <- reads str] instance Storable SerializedEventKey where sizeOf _ = #{const sizeof (GdkEventKey)} alignment _ = alignment (undefined:: #gtk2hs_type gint) peek ptr = peekSerializedKey ptr poke ptr event = pokeSerializedKey ptr event serializedEvent :: EventM t SerializedEventKey serializedEvent = do ptr <- ask eType <- liftIO $ do (typ::#gtk2hs_type GdkEventType) <- #{peek GdkEventAny,type} ptr return typ case eType of #{const GDK_KEY_PRESS} -> serializedKey #{const GDK_KEY_RELEASE}
[Haskell-cafe] Read Instance code.
Hi all, I have some incorrect "Read instance" make i got error "Prelude.read: no parse", and i don't know how to fix it. --> code start <-- newtype SerializedWindow = SerializedWindow (Maybe DrawWindow) instance Show SerializedWindow where show _ = "SerializedWindow Nothing" instance Read SerializedWindow where readsPrec _ str = [(SerializedWindow Nothing, idStr) | (val :: String, idStr) <- reads str] --> code end <-- Any help? Thanks! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Are you a Haskell expert? [How easy is it to hire Haskell programmers]
Brandon S Allbery KF8NH writes: > On 7/3/10 05:57 , Andrew Coppin wrote: >> Agreed. So let me rephrase: Why should _every_ Haskell library involve C? ;-) > > Who says they do, or should? AFAIK it's only done for the reasons I > mentioned (or, sometimes, for library compatibility; a native XCB library > has been considered, for example, but it wouldn't share state with the XCB > used by OpenGL, WxWindows, or gtk2hs (to name a few) so might have > interoperability problems). When possible pure Haskell is preferred, but > there's a lot of complex libraries out there that one should not try to > rewrite. Yes, i agree. Let us make a GTK + example, why some popular languages such as Java, Python does not rewrite the GTK+? I think the key is not which language is best language to rewrite those *complex* library, the key is we need work together! That's why Haskell build FFI to work with other language. -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Are you a Haskell expert? [How easy is it to hire Haskell programmers]
Andrew Coppin writes: > Don Stewart wrote: > So I guess that means that I don't count as a "knowledgable" Haskell > programmer. :-( > RWH is free and online, and covers many useful things. There's no excuse :-) > > I was about to say "yeah, but RWH isn't that good" - and then I noticed who > I'm speaking to. ;-) > > So let me rephrase that: RWH isn't as good as I was hoping it would be. > Still, since I haven't > written anything better myself, I guess I don't get to criticise... > > In any case, surely the Typeclassopedia would be a far better place to > comprehend Applicative? > >> Writing libraries that bind to C is a great way to have to use a lot of >> hsc2hs (or c2hs), so clearly you need to contribute more libraries :-) >> > > So hsc2hs is related to writing C bindings? Well, that'll be why I've never > heard of it then; I > don't understand C. (Nor do I particularly want to... I chose Haskell.) > > Besides, why in the world do Haskell libraries have to involve C? Because we need to reuse those existing high-quality C library, such as GTK+ library. Because so many people into their's efforts to these C library, it's really unnecessary re-implement those *huge* C library by Haskell. C binding perhaps not the perfect way, but it's cheapest way to fix your *real* problem. Don't tell me you want spend 10 years build Haskell Purely Graphics Toolkit even you just want do some GUI program. ;-) IMO, C is best way to handle hardware detail, that's the another reason need C binding... Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TH instance code.
Hi Edward, Thank you very much, your code works perfect! -- Andy Edward Kmett writes: > v-- I had accidentally elided the _'s before the t's in the quasiquotation > before. > > What you're looking for is something like: > > deriveVariable _t = [d| > instance Variable $_t where > toVariant = toVariant . show > fromVariant x = fmap (\v -> read v :: $_t) $ fromVariant x|] > > deriveVariable (conT ''PageType) > deriveVariable (conT ''Int) > deriveVariable (conT ''Maybe `appT` conT ''Char) > ... > > On Tue, Jun 22, 2010 at 11:24 AM, Andy Stewart > wrote: > > Hi all, > > I have below duplicate code, but i don't know how to use TH instance > code. > > --> duplicate code start > <-- > instance Variable PageType where > toVariant = toVariant . show > fromVariant x = fmap (\v -> read v :: PageType) $ fromVariant x > > instance Variable Int where > toVariant = toVariant . show > fromVariant x = fmap (\v -> read v :: Int) $ fromVariant x > > instance Variable (Maybe Char) where > toVariant = toVariant . show > fromVariant x = fmap (\v -> read v :: Maybe Char) $ fromVariant x > > instance Variable (Maybe Int) where > toVariant = toVariant . show > fromVariant x = fmap (\v -> read v :: Maybe Int) $ fromVariant x > > instance Variable ProcessID where > toVariant = toVariant . show > fromVariant x = fmap (\v -> read v :: ProcessID) $ fromVariant x > > instance Variable GWindowId where > toVariant = toVariant . show > fromVariant x = fmap (\v -> read v :: GWindowId) $ fromVariant x > --> duplicate code end > <-- > > Any TH expert help? > > Thanks, > > -- Andy > > ___ > 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] TH instance code.
Hi all, I have below duplicate code, but i don't know how to use TH instance code. --> duplicate code start <-- instance Variable PageType where toVariant = toVariant . show fromVariant x = fmap (\v -> read v :: PageType) $ fromVariant x instance Variable Int where toVariant = toVariant . show fromVariant x = fmap (\v -> read v :: Int) $ fromVariant x instance Variable (Maybe Char) where toVariant = toVariant . show fromVariant x = fmap (\v -> read v :: Maybe Char) $ fromVariant x instance Variable (Maybe Int) where toVariant = toVariant . show fromVariant x = fmap (\v -> read v :: Maybe Int) $ fromVariant x instance Variable ProcessID where toVariant = toVariant . show fromVariant x = fmap (\v -> read v :: ProcessID) $ fromVariant x instance Variable GWindowId where toVariant = toVariant . show fromVariant x = fmap (\v -> read v :: GWindowId) $ fromVariant x --> duplicate code end <-- Any TH expert help? Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: How does one get off haskell?
"Edward Z. Yang" writes: > Excerpts from Bryan O'Sullivan's message of Fri Jun 18 13:16:58 -0400 2010: >> I'm inclined to disagree. It's precisely when the code is in a state of >> constant upheaval that I want the type system to be pointing out my dumb >> errors. > > In my experience, the type system has forced me to care about thing that I > don't want to care about (yet). It's a different mindset: in the words of the > prototyper: being first is valued over being correct. > > This does mean that Haskell forces you to write long-term maintainable > code from the get-go, yes. :-) Haha, that's true. :) When i write Haskell code, it force me write *framework* code. Sometimes, i wrote dirty code quickly, Haskell will told me : "Hey, bad code! Rewrite it! I don't accept dirty code ... bla bla ...". Then i rewrite my code to make it flexible and maintainable. Once you build beautiful framework code, you will find your life is so simple. :) Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Unicode vs. System.Directory
Hi Arie, If you don't mind binding code. You can try to use GIO APIs from my repository: http://patch-tag.com/r/AndyStewart/gio-branch/home GIO APIs handle unicode filename every well, and cross-platform. Cheers, -- Andy Arie Peterson writes: > After upgrading to haskell-platform-2010.1.0.0, with the improved unicode > support for IO in ghc-6.12, I hoped to be able to deal with filenames > containing non-ascii characters. This still seems problematic, though: > > $ ls > m×n♯α > $ ghci > GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help > Prelude> :m +System.Directory > Prelude System.Directory> getDirectoryContents "." >>= mapM_ putStrLn > .. > mÃnâ¯Î± > . > > I hope this passes through the various email systems unharmed; on my > terminal, the output of 'ls' contains shiny unicode characters, while > 'ghci' garbles up the filename. (My locale is en_GB.utf8.) > > Similar problems arise with functions such as 'copyFile', which refuses to > handle filenames with non-ascii characters (unless wrapping it with > encoding functions). > > > Is this a known problem? I searched ghc's trac, but there are no relevant > bugs for the component 'libraries/directory'. > > > I have parts of a unicode-aware layer on top of System.Directory laying > around somewhere. I was rather hoping to ditch it, but I can polish it and > put it on hackage, if people are interested. > > > Kind regards, > > Arie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskell and scripting
Daniel Fischer writes: > On Wednesday 05 May 2010 23:36:26, Limestraël wrote: >> but you will not object if I say that scheme is quicker to learn >> than Haskell. > > Well, I do object. Learning Haskell went like a breeze (not to perfection, > but well enough). Only Python was nearly as easy and quick to learn. > Learning Lisp dialects is much harder (to a large part because of the > parentheses, which makes them near impossible to parse). Perhaps you need perfect lisp editor (emacs) to help you parse those parentheses. :) Looks below extension to highlight parentheses if you're emacser. It help you parse parentheses when you through *parentheses forest*. http://www.emacswiki.org/emacs/HighlightParentheses -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Mirror repository for gtk2hs
Hi all, Because code.haskell.org is unstable recently, and many gtk2hs users can't get code from http://code.haskell.org/gtk2hs So i build a mirror repository at http://patch-tag.com/r/AndyStewart/gtk2hs-sync-mirror/home You can access this mirror repository when code.haskell.org down. This mirror repository synchronous http://code.haskell.org/gtk2hs Hourly. Because mirror repository just read-only, please send any patches to gtk2hs main repository (http://code.haskell.org/gtk2hs) I need thanks "Thomas Hartman" (the administor of patch-tag.com), i can't build this mirror repository if haven't his help. Thanks Thomas! Enjoy, everybody! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: nun.haskell.org http services down?
Ivan Lazar Miljenovic writes: > Erik de Castro Lopo writes: > >> Jens Petersen wrote: >> >>> http://{code,community,projects}.haskell..org/ seem to be inaccessible. >>> >>> Could someone please look into it? >> >> For me, it seems to be down everyday around 5-6pm (0700-0800 UTC) which >> is prime hacking time for me. >> >> Anyone know what's going on with the machine at that time? > > Well, it's hosted in the USA which is somewhere around UTC-8; as such > your prime hacking time is prime sleeping time for those poor old > servers! Let the poor dears rest! ;-) Unfortunately, I come from China. :-( code.haskell.org is always down in my time. -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: gtk2hs for 2010.1.0.0
Hi Ivan, Ivan Miljenovic writes: > On 4 May 2010 04:21, Maciej Piechotka wrote: >> Does anyone have installer for gtk2hs for Haskell Platform 2010.1.0.0? > > Considering that there is as yet no release of gtk2hs that supports > GHC-6.12.*, it seems unlikely. At best someone may have taken a > snapshot of the darcs repo and built that. I have test gtk2hs darcs with GHC-6.12*, And result is gtk2hs works well with 6.12.1, and can compile under 6.12.2 But gtk2hs program got "segmentation fault" under 6.12.2 somehow. I doubt 6.12.2 break c2hs-branch in gtk2hs. I have tick it at : http://hackage.haskell.org/trac/ghc/ticket/4038 So my suggestion is: Use gtk2hs with 6.12.1 instead 6.12.2. I have test it, gtk2hs can works stable with 6.12.1 Of course, 6.10* can works well too. Currently, gtk2hs darcs repo can install by Cabal, just get code, then "./bootstrap.sh", it will build everything for you. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: gtk2hs for 2010.1.0.0
Hi Maciej, Maciej Piechotka writes: > On Mon, 2010-05-03 at 19:21 +0100, Maciej Piechotka wrote: >> Does anyone have installer for gtk2hs for Haskell Platform 2010.1.0.0? >> >> Regards >> ___ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > I mean of course windows installer ;) Installing on Linux is as simple > as emerge haskell-platform gtk2hs ;) Perhaps Windows installer still need some time, some problem with c2hs-branch in gtk2hs, and problem with header file name. Please send any problem or suggestion to gtk2hs list, i have seen some guys works on it, (such as, the author of leksah). But i think it's should not too long because we have convert gtk2hs to Cabal packages. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Why haskell.org down again?
Hi all, haskell.org down again? Hardware not stable? Attack? Can't we avoid haskell.org off? -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Finish Gtk2hs APIs update!
Hi all, After two weeks work, i have finish update Gtk2hs APIs to Gtk+2.18.3! Gdk and Pango APIs have update to newest version. Please report any problem to gtk2hs mail-list, we can fix it as soon as we can. Below is libraries that gtk2hs support: -> libraries list start <--- Glib Gdk Gtk+ Pango Cairo GConf GIO Glade GnomeVFS Gstreamer OpenGL SourceView SourceView2 Mozembed SOE SvgCairo VTE Webkit > libraries list end < Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskellers hate GUIs!!
Hi Jürgen, For GHC-6.12, just darcs version support. So please download darcs version. Axel has working on that make gtk2hs build on cabal. And i'm working on update All gtk2hs API to Gtk+ 2.18.3 (have finish 99%), i can finish all APIs in later days. Axel have finish some sub-modules on http://www2.in.tum.de/~simona/ (Note, above cabal packages not include patches i push recently) After we finsh work, we can merge gtk2hs into Haskell Platform. Because gtk2hs just interface code for low-level C library, so it's stable enough. As recently so much new code push in gtk2hs, perhaps have bug. So please report any problem on gtk2hs mail-list, we can fix it as soon as we can. -- Haskller GUI lover Jürgen Nicklisch-Franken writes: > I am in the damned position to have tried to develop a GUI app in > Haskell. I'm building on top of gtk2hs, now we have a new compiler > version a new Platform release and no gtk2hs release, so > I cite from a mail from a potential user/contributor for my GUI app. > What shall I say, how should he install gtk2hs? Is their a way to get a > stable version from a changing darcs repo? > If not all Haskellers were such GUI haters, we would have GUI libs with > the platform. > > Jürgen > > " > ... > Each gtk2hs package (like glib-0.10.1) installed in that > non-standard > location by Ubuntu apt-get does at least have a package.conf > file, like > glib.package.conf. However, on inspection, the "id" fields are > missing, > and the "depends" fields look more like .cabal file "depends" > fields (no > ABI ID). > > I tried an experiment on my glib.package.conf, used "ghc > --abi-hash" to > generate an ID, so eventually creating a new line something like > > id: glib-0.10.1-d41d8cd98f00b204e9800998ecf8427e > > and then set up the "depends" properly by getting the real > dependencies > using "ghc-pkg -v list". > > After doing this then > > ghc-pkg register glib.package.conf > > worked just fine, and I see it in my global DB. It's cool that > this > works but it seems highly roundabout. :-) > > > Building gtk2hs from source is broken. Not sure why - I did it > OK with > ghc-6.10.3. I can run ./configure no problem with > > ./configure --with-hcflags=-O0 --disable-split-objs > --with-ghc=/usr/local/lib/ghc-6.12.1 > > and it claims that it will build: > > * The following packages will be built: > * > * glib : yes > * gtk: yes > * gio: yes > * glade : yes > * cairo : yes > * svgcairo : yes > * gtkglext : no > * gconf : yes > * sourceview : no > * gtksourceview2 : yes > * mozembed : no > * soegtk : yes > * gnomevfs : no > * gstreamer : yes > * documentation : no > > But "make" fails horribly...can't find any packages like "base" > that > configure had no problems finding, so I have no idea what the > problem is > there. Which is why I'd rather figure out a way to make > ghc-6.12.1 > recognize the gtk2hs packages that I have in that non-standard > location. > > It works but it's awkward. :-) > > Each gtk2hs package (like glib-0.10.1) installed in that > non-standard > location by Ubuntu apt-get does at least have a package.conf > file, like > glib.package.conf. However, on inspection, the "id" fields are > missing, > and the "depends" fields look more like .cabal file "depends" > fields (no > ABI ID). > > I tried an experiment on my glib.package.conf, used "ghc > --abi-hash" to > generate an ID, so eventually creating a new line something like > > id: glib-0.10.1-d41d8cd98f00b204e9800998ecf8427e > > and then set up the "depends" properly by getting the real > dependencies > using "ghc-pkg -v list". > > After doing this then > > ghc-pkg register glib.package.conf > > worked just fine, and I see it in my global DB. It's cool that > this > works but it seems highly roundabout. :-) > > I think I'll pack it in for the eveni
[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity
Simon Marlow writes: > On 26/03/2010 19:51, Isaac Dupree wrote: >> On 03/25/10 12:36, Simon Marlow wrote: >>> I'd also be amenable to having block/unblock count nesting levels >>> instead, I don't think it would be too hard to implement and it wouldn't >>> require any changes at the library level. >> >> Wasn't there a reason that it didn't nest? >> >> I think it was that operations that block-as-in-takeMVar, for an >> unbounded length of time, are always supposed to C.Exception.unblock and >> in fact be unblocked within that operation. Otherwise the thread might >> never receive its asynchronous exceptions. > > That's why we have the notion of "interruptible operations": any operation > that blocks for an > unbounded amount of time is treated as interruptible and can receive > asynchronous exceptions. > > I think of "block" as a way to turn asynchronous exceptions into synchronous > ones. So rather that > having to worry that an asynchronous exception may strike at any point, you > only have to worry about > them being throw by blocking operations. If in doubt you should think of > every library function as > potentially interruptible, but that still means you usually have enough > control over asynchronous > exceptions to avoid problems. > > If things get really hairy, consider using STM instead. In STM an > asynchronous exception causes a > rollback, so maintaining your invariants is trivial - this is arguably one of > the main benefits of > STM. There's no need for block/unblock within STM transactions. Hi Isaac, Yep, like Simon said, use STM instead. STM will build thread-log for every TVar, in normal, every thread just execute STM code, and don't care other threads state, current thread will check thread-log when TVar need write, if okay, it will write value, if have conflict with other threads, current action will rollback and re-execute. And STM's usage is simple enough, so i recommend use STM fix your problem. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: gtk2hs gtkbuilder
"Andrew U. Frank" writes: > i currently use gtk2hs with libglade (and glade). i understand that the > gtkbuilder allows more constructs than libglade. how to use gtkbuilder in > gtk2hs? i see that John Millikin has posted a patch for gtk2hs - but i cannot > find it and no documentation for its use? can anyone point me to a patched > version of gtk2hs and some examples? You can see demo program under `demo/gtkbuilder` of gtk2hs. Just do `make`, then run ./gtkbuilder Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: What's wrong with code.haskell.org ?
Svein Ove Aas writes: > On Sun, Nov 22, 2009 at 4:39 AM, John Millikin wrote: >> code.h.o and community.h.o have rather flaky hosting, and have been >> going down often recently. The only solution seems to be waiting until >> the admins notice. >> > They have hardware problems - dying HDs and such. > > IIRC there were plans to replace the problematic hardware, but I don't > know how far that has gotten. Maybe we should have a fundraiser for > the purpose? Hope they can fix this problem completely, then running stable... -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] What's wrong with code.haskell.org ?
Hi all, I can't use `darcs get --partial http://code.haskell.org/gtk2hs/` to get source code, and can't push patch. What's wrong with code.haskell.org? Rest for weekend? :) -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to update SSH key in code.haskell.org
Hi all. I'm a developer of gtk2hs project at code.haskell.org But i found i lost my SSH key when i update new system, and i can't push patch to gtk2hs. I have send mail to supp...@community.haskell.org for this problem, but i'm not sure that's the right place. So how to update SSH key with my account (AndyStewart) ? Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Problem about hidden package again.
Magicloud Magiclouds writes: > Just joking. But still, since gtk2hs still using the configure/make > way, it is complex to add another option to the system. I tried to add > array to build-depends of Cairo.cabal, no luck. Yes, it's not handy that gtk2hs can't use Cabal. But i think this is not easy when gtk2hs contain some many modules. -- Andy > > On Thu, Nov 12, 2009 at 5:28 PM, Magnus Therning wrote: >> On Thu, Nov 12, 2009 at 9:11 AM, Magicloud Magiclouds >> wrote: >>> No, it is not. I used configure/make way. >>> Well I just noticed that there is a "hide-all-package" options to ghc. >>> I do not know why. Maybe the author went crazy. >> >> Chances are the auther DIDN'T go crazy :-) >> >> It's a common practice to hide all packages, and then only bring the >> ones needed into visibility. I doubt that Gtk2hs is completely self >> contained, so somewhere in there is the directives that makes the >> needed packages visible again. Just add array and you should be past >> this particular hurdle. >> >> /M >> >> -- >> Magnus Therning (OpenPGP: 0xAB4DFBA4) >> magnus@therning.org Jabber: magnus@therning.org >> http://therning.org/magnus identi.ca|twitter: magthe >> ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Long running Haskell program
David Leimbach writes: > As some of you may know, I've been writing commercial Haskell code for a > little bit here (about a > year and a half) and I've just recently had to write some > code that was going to run have to run for a really long time before being > restarted, possibly > months or years if all other parts of the system cooperate as > it's part of a server infrastructure management system. > > I recently ran into some serious space leak difficulties that would > ultimately cause this program to > crash some time after startup (my simulator is also > written in Haskell, and runs a LOT faster than the real application ever > could, this has enabled me > to fast forward a bit the data growth issues and crash > in minutes instead of days!) > > Anyway, rather than try to paste it all here with images and such I thought > I'd stick it up on my > blog so others could maybe benefit from the anecdote. > It's difficult to disclose enough useful information as it is commercial > code not under an open > source license, but there's neat diagrams and stuff there > so hopefully the colors are at least amusing :-) > > http://leimy9.blogspot.com/2009/11/long-running-haskell-applications.html Can you copy you blog at here? http://leimy9.blogspot.com/2009/11/long-running-haskell-applications.html is filter by GFW (http://en.wikipedia.org/wiki/Golden_Shield_Project) i can't see it. About crash free program, you can consider multi-process design, keep Simple and Stable core running in RootProcess, and Core module won't crash, and make unstable module running in ChildProcess, if you occur some un-catch exception from ChildProcess, just reboot those sub-module. I'm research some Haskell/Gtk+ program, sometimes un-catch exception is unavoidable, multi-process is good chose to avoid some exception crash all program. Cheers, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Help me improve design of my project.
Andy Stewart writes: > Hi all, > > Okay, question is, IORefObject module and most module reference each > other, so i will got `recursive reference problem` (looks how many > .hs-boot in my project). Current version compile fine. The key is design of IORefObject, It's too close with Manatee.UI.* modules, they're import each other, make i need .hs-boot file to avoid recursive reference problem. And those strongly connect components point that's a bad design at IORefObject. So any suggestions are welcome! Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Some question about c2hs.
Hi all, I try to binding Haskell to VTE library. Below are Vte.chs file i wrote. Vte.chs Description: Binary data I use c2hs with below command LANG=C c2hs -d trace -l $(pkg-config --cflags vte | sed 's/-I/-C-I/g') vte/vte.h Vte.chs generate Vte.hs file. When i compile Vte.hs file, i got below error: Vte.chs:67:89: Couldn't match expected type `Widget' against inferred type `()' Expected type: IO (Ptr Widget) Inferred type: IO (Ptr ()) In the second argument of `($)', namely `vte_terminal_new' In the second argument of `($)', namely `liftM (castPtr :: Ptr Widget -> Ptr Terminal) $ vte_terminal_new' for binding code: terminalNew :: IO Terminal terminalNew = makeNewObject mkTerminal $ liftM (castPtr :: Ptr Widget -> Ptr Terminal) $ {#call unsafe terminal_new#} In C code, fucntion `GtkWidget *vte_terminal_new(void);' return `IO (Ptr Widget), then i use castPtr transform (Ptr Widget) to (Ptr Terminal), right? Why GHC report function `vte_terminal_new` return `IO (Ptr ())', I do something wrong? Any help? Thanks! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to use Template Haskell build Map?
Hi all, I have below instances: instance PageViewState DiredViewState where instance PageViewState StringViewState where I can use Language.Haskell.Exts.Parser scan above instances got list: typeList :: [Type] typeList = [TyCon (UnQual (Ident "DiredViewState")),TyCon (UnQual (Ident "DiredViewState"))] So question is how to use Template Haskell and above `typeList` build below `Map` at compile-time? tagmap = M.fromList [(typeIdOf StringViewState, Exists (Dict :: PageViewStateDict StringViewState)) ,(typeIdOf DiredViewState, Exists (Dict :: PageViewStateDict DiredViewState))] Thanks! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: How to customize dyre recompile?
Will Donnelly writes: Hi Will, > Hi Andy, > > I feel that I should offer a disclaimer here: You are misusing Dyre > somewhat by attempting to make it handle whole-program recompilation. > It is designed to recompile a single configuration file, generally > against an installed library form of the application. Some of its > code, specifically the part that decides when to recompile, is based > almost entirely on this assumption. I use dyre for develop dynamic gtk application, so i hope dyre do whole-program recompilaton and just recompile necessary files. Just recompile single file or force recompile all modules is not my desire. It's better if dyre's support single file recompliation and whole-program recompilation, isn't? :) > > That aside, you should be able to accomplish your goals like this: > > 1. Set the 'forceRecomp' parameter (just added in Dyre 0.7.3) to > 'False'. This will remove the '-fforce-recomp' flag from GHC's > options. > 2. Run your executable with the '--force-reconf' flag, which will > cause Dyre to always enter the recompilation code. Now i use below code finish work: --> code start <-- rebootParams :: Params Config rebootParams = defaultParams {projectName = "Main" ,realMain= manatee ,showError = rebootShowError ,cacheDir= Just $ return "/test/Download/cache/" ,configDir = Just getCurrentDirectory ,forceRecomp = False-- don't recompile all modules, steup for recompile whole-program } rebootOptions :: Maybe [String] rebootOptions = Just ["--force-reconf"] rebootShowError :: Config -> String -> Config rebootShowError cfg msg = cfg {errorMsg = Just msg} reboot :: IORefObject -> IO () reboot ioRefObject = do rs <- rebootGetState ioRefObject relaunchWithBinaryState rs rebootOptions --> code end <-- BTW, looks dyre don't recommand user use function `customCompile`, when it will call in function `wrapMain' always. If i just use relaunch function, i just got simple error information: "Error occurred while loading configuration file." when recompile failed. How to display detail information when recompile failed? I missing something? Thanks! -- Andy > > In a test project I just created, this seems to do what you desire. > > Hope this helps clear things up > - Will Donnelly > > On Sun, Sep 6 2009 at 1:41 PM, Andy Stewart wrote: >> >> Hi all, >> >> I use below params for configure dyre: >> >> rebootParams :: Params Config >> rebootParams = defaultParams >> {projectName = "Main" >> ,realMain = manatee >> ,showError = rebootShowError >> ,cacheDir = Just $ return "/test/Download/cache/" >> ,configDir = Just getCurrentDirectory >> } >> >> There have two version of function `reboot` to reboot Master binary: >> >> reboot :: IORefObject -> IO () >> reboot ioRefObject = do >> rs <- rebootGetState ioRefObject >> relaunchWithBinaryState rs Nothing >> >> reboot :: IORefObject -> IO () >> reboot ioRefObject = do >> output <- customCompile rebootParams >> case output of >> Just o -> putStrLn o -- output recompile error >> Nothing -> do -- otherwise relaunch >> rs <- rebootGetState ioRefObject >> relaunchWithBinaryState rs Nothing >> >> Becuase i setup `projectName` with `Main`, so i want `dyre` recompile >> NECESSARY module when i change any module in my project. >> >> In first version of function `reboot`, i just use >> `relauncheWithBinaryState`, i found `dyre` just recompile all project when i >> modified Main.hs, if i modified any others module in project, `dyre` >> won't recompile those modified modules. >> >> In second version, i use `customCompile` for recompile, but this have >> another problem, `customComiple` use `-fforce-recomp` flags to remove >> all object files, so function `customComiple` will recompile all modules >> in project, and not just recompile NECESSARY modules. >> >> So how to make `dyre` just recompile NECCESSARY modules whatever i >> change any modules in project? >> >> Maybe add new option "--dyre-reconf-necessary" in `dyre`? >> >> Thanks! >> >> -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to customize dyre recompile?
Hi all, I use below params for configure dyre: rebootParams :: Params Config rebootParams = defaultParams {projectName = "Main" ,realMain= manatee ,showError = rebootShowError ,cacheDir= Just $ return "/test/Download/cache/" ,configDir = Just getCurrentDirectory } There have two version of function `reboot` to reboot Master binary: reboot :: IORefObject -> IO () reboot ioRefObject = do rs <- rebootGetState ioRefObject relaunchWithBinaryState rs Nothing reboot :: IORefObject -> IO () reboot ioRefObject = do output <- customCompile rebootParams case output of Just o -> putStrLn o -- output recompile error Nothing -> do -- otherwise relaunch rs <- rebootGetState ioRefObject relaunchWithBinaryState rs Nothing Becuase i setup `projectName` with `Main`, so i want `dyre` recompile NECESSARY module when i change any module in my project. In first version of function `reboot`, i just use `relauncheWithBinaryState`, i found `dyre` just recompile all project when i modified Main.hs, if i modified any others module in project, `dyre` won't recompile those modified modules. In second version, i use `customCompile` for recompile, but this have another problem, `customComiple` use `-fforce-recomp` flags to remove all object files, so function `customComiple` will recompile all modules in project, and not just recompile NECESSARY modules. So how to make `dyre` just recompile NECCESSARY modules whatever i change any modules in project? Maybe add new option "--dyre-reconf-necessary" in `dyre`? Thanks! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: How to use dyre relaunch/restore State of Gtk2hs Object?
Will Donnelly writes: HI Will, First, thanks for your detail explain. > Hi Andy, > > Your program didn't compile as given, so I cut out some of the event handling > fanciness you were > doing. Also, my modified version restarts whenever the 'r' > key is pressed. I figure those changes aren't important to the problem at > hand. > > Anyway, I don't think it's ever going to be possible to define a Binary > instance for a TextView, > since all of the functions which can yield information > about it are impure. I would recommend extracting the relevant data > beforehand, and then persisting > it in a tuple. You could use some 'marshal' and > 'recreate' functions if you need to persist many different widget > types. Saving just the > text can be done as follows: Before your mail, i thinking long time to integrate dyre with gtk2hs program. I have three need to dynamic reconfigure gtk2hs program. 1-> Entry new version master binary if recompile successful. (dyre have implement this with relaunchMaster) 2-> Recompile new module dynamic for update algorithms. (dyre have implement this) 3-> Keep gtk2hs object state through reboot. Now just point (3) need solve. To keep GTK widget state, it's un-necessary to define a Binary instance for Gtk2hs object (and not possible), we just need extract relevant data from widget ( for TextView, we can extract text, iter, etc. ), then recreate widget with states after we relaunch master binary. Then we can keep gtk2hs state through reboot. Below is my analysis that how to keep gtk2hs object state: gtk2hs use c2hs binding Haskell to C, c2hs will use Ptr point to C struct address when it found current type is C struct. So we can't save pointer address for restore, because pointer address will not valid after relaunch master binary. Second solution, we can use Haskell define pure state model, then use gtk2hs rendering data. Example, we can use Haskell define "data HaskellTextBuffer" for keep Buffer information for TextView. But this solution have it's disadvantage, we need do duplicate work in HaskellTextBuffer that TextBuffer have do. And between TextBuffer and TextView have many relevant C functions need handle, and this solution is not neat. Third solution, we just need define new type that store necessary information to recreate widget, example like below: data TextViewState -- | TextBuffer -> Text | | TextBuffer -> Iter | -- Save TextViewState => Dyre recompile => Restore TextViewState => Recreate widget with TextViewState > > > module DyreExample where > > import Graphics.UI.Gtk hiding (get) > import qualified Graphics.UI.Gtk.Gdk.Events as E > > import qualified Config.Dyre as Dyre > import Config.Dyre.Relaunch > > import System.IO > import Data.Binary > > data Config = Config { message :: String, errorMsg :: Maybe String } > > defaultConfig :: Config > defaultConfig = Config "Dyre Example v0.1" Nothing > > showError :: Config -> String -> Config > showError cfg msg = cfg { errorMsg = Just msg } > > realMain Config{message = message, errorMsg = errorMsg } = do > initGUI > > textView <- textViewNew > textBuffer <- textViewGetBuffer textView > text <- restoreBinaryState "" > putStrLn $ "Restored state: " ++ text > textBufferSetText textBuffer text > > rootWindow <- windowNew > rootWindow `onDestroy` mainQuit > windowFullscreen rootWindow > > rootWindow `containerAdd` textView > > widgetShowAll rootWindow > > rootWindow `onKeyPress` (\event -> dyreKeyTest event textView) > > mainGUI > > dyreExample = Dyre.wrapMain $ Dyre.defaultParams > { Dyre.projectName = "Main" > , Dyre.realMain = realMain > , Dyre.showError = showError > } > > dyreKeyTest :: E.Event -> TextView -> IO Bool > dyreKeyTest ev textView = do > case E.eventKeyName ev of > "r" -> do textBuffer <- textViewGetBuffer textView >sI <- textBufferGetStartIter textBuffer >eI <- textBufferGetEndIter textBuffer >text <- textBufferGetText textBuffer sI eI True >putStrLn $ "Relaunching with state: " ++ text >relaunchWithBinaryState text Nothing >return True > _ -> return False > > > Other comments: > 1. It isn't necessary to explicitly tell Dyre to do a custom compile. It > will take care of > figuring that out once you restart it. > 2. Instead of manually setting paths in the code, you can use the > '--dyre-debug' command-line > flag, which will cause Dyre to look for configurations in > the current directory, and store temporary files in a 'cache' subdirectory. > 3. Giving a project name of 'Main' causes Dyre to see the file 'Main.hs' as > a custom > configuration. I'm not sure if that's what you intended, but it will > make testing custom configurations harder than it needs to be. > 4. Good luck with the rest of your project! Thanks for your suggestions! :) -- Andy >
[Haskell-cafe] How to use dyre relaunch/restore State of Gtk2hs Object?
Hi all. I try to use dyre (http://hackage.haskell.org/packages/archive/dyre/0.7.2/doc/html/Config-Dyre.html) to relaunch/restore State of TextView to make TextView's content can't lost when main program reboot. Below is source code for example: --> source code start <-- module DyreExample where import Graphics.UI.Gtk hiding (get) import qualified Config.Dyre as Dyre import Config.Dyre.Relaunch import Config.Dyre.Compile import System.IO import Event import Test import Data.Binary import qualified Graphics.UI.Gtk.Gdk.Events as E data Config = Config { message :: String, errorMsg :: Maybe String } defaultConfig :: Config defaultConfig = Config "Dyre Example v0.1" Nothing showError :: Config -> String -> Config showError cfg msg = cfg { errorMsg = Just msg } realMain Config{message = message, errorMsg = errorMsg } = do initGUI textView <- textViewNew tn <- restoreTextState testName tv <- restoreBinaryState textView putStrLn tn rootWindow <- windowNew rootWindow `onDestroy` mainQuit windowFullscreen rootWindow -- rootWindow `containerAdd` textView rootWindow `containerAdd` tv widgetShowAll rootWindow rootWindow `onKeyPress` (\event -> dyreKeyTest event textView) mainGUI dyreExample = Dyre.wrapMain $ Dyre.defaultParams { Dyre.projectName = "Main" , Dyre.configDir = Just (return "/home/andy/Projects/Haskell/dyre/") , Dyre.cacheDir= Just (return "/test/Download/cache/") , Dyre.realMain= realMain , Dyre.showError = showError } dyreMainParams = Dyre.defaultParams { Dyre.projectName = "Main" , Dyre.configDir = Just (return "/home/andy/Projects/Haskell/dyre/") , Dyre.cacheDir= Just (return "/test/Download/cache/") , Dyre.realMain= realMain , Dyre.showError = showError } dyreTestParams = Dyre.defaultParams {Dyre.projectName = "Test" ,Dyre.configDir = Just (return "/home/andy/Projects/Haskell/dyre/")} dyreKeyTest :: E.Event -> TextView -> IO Bool dyreKeyTest ev textView = do case eventTransform ev of Nothing -> return False Just e -> do let eventName = eventGetName e case eventName of "M-m" -> do out2 <- customCompile dyreMainParams putStrLn $ show out2 relaunchWithTextState testName Nothing relaunchWithBinaryState textView Nothing return True _ -> return False -- instance Binary TextView where -- put a = put a -- get = get --> source code end <-- On the surface, just add TextView's Binary instance can fix problem. But TextView is Haskell binding (by gtk2hs) for C struct in GTK+ library, i wonder how to write Binary instance for TextView. My aim is write GUI program (through gtk2hs) will keep GUI State when main program recompile/reboot (like XMonad). Example, above code, i add TextView widget in Window, and type "I love Haskell" in it, when this program recompile/reboot itself, the content "I love Haskell" still display in TextView widget, and not empty. So any ideas or suggestions? Thanks! -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe