Re: [Haskell-cafe] reasons why Template Haskell does not propose something similar to Python exec() or eval()
Excerpts from TP's message of Sat Aug 24 11:36:04 +0200 2013: Haskell does not propose something similar to Python (or bash) exec() or eval(), i.e. does not offer the possibility to take a (quoted) string in You actually have eval/exec like features. You can run ghc modules in a haskell application to compile a module, then run that code. Eg see this example to get started http://mawercer.de/tmp/haskell-dyn-loading-example.zip Origin of most ideas was this site: http://codeutopia.net/blog/2011/08/20/adventures-in-haskell-dynamic-loading-and-compiling-of-modules/ Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: module-management-0.9.3 - clean import lists, split and merge modules
Excerpts from John Wiegley's message of Fri Jun 28 05:46:31 +0200 2013: How about building an executable along with the library called cleanImports, Does it require knowledge about the libraries to be used? If so eventually it should be a cabal option? Or it should be able to load dependencies from a cabal configure file (.dist/something). Then there should also be an env var CABAL_CURRENT_DIST_DIR or such, because sometimes you want to work on multiple dist directories. cabal could honor this itself. Then you could export CABAL_CURRENT_DIST_DIR=dist-foo ./Setup configure ./Setup build cleanImports FOO And everything would work without --dist-dir=dist-foo parameter ? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: module-management-0.9.3 - clean import lists, split and merge modules
Dear David, would you mind adding a short intro about how to use your library? I mean editor plugin authors may want to know whether or how to integrate the features of your library ? From looking at the cabal file I see there is a library and a commented tests (by the way you can make tests optional by using cabal flags). (before library/ executables): flag build_test description: build the test executable default: Fales To the executable add: if !flag(build_test) buildable: False Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: module-management-0.9.3 - clean import lists, split and merge modules
let me give you an example: splitModule :: MonadClean m = ModuleName - m () Split each of a module's declarations into a new module. Update the imports of all the modules in the moduVerse to reflect the split. Why do I want that? What does it mean? === start file == module Start where a = 1 b = 2 c = 3 will calling that function yield module foobar where a = 1 module baz.something.idont.know where b =2 module 3rd where c =3 I want to say: I have no idea - how the new modules will be named - which paths the new modules will have Function's return type is m (), so doesn't help much. Consider improving that documentation. More questions: input/output. findPaths Language = runMonadClean . mapM cleanImports . toList Whose task is it to write the new cleaned up module to disk again? does runMonadClean do it for me? Docs don't tell yet. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: module-management-0.9.3 - clean import lists, split and merge modules
Excerpts from David Fox's message of Fri Jun 28 04:04:59 +0200 2013: So you will get modules Start.A, Start.B and Start.C. If there are But that's very unlikly what the programmer wants. I mean I might want Types and Funs as module names, move A,B to Types, C to Funs. I agree that I could reach my goal using a merge afterwards ? Because some modules may have many symbols having that many files created feels strange. Useful for the programmer (me?) would be: up to line 200 move to A, from 200 till end move to module B Even if you think the way to go is creating 50 files (because you happen to have 50 symbols) you may want to consider telling the user that he knows what to expect - and that you welcome patches to make this even nicer and more useful. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Ticking time bomb
The only safe way is acceptnig keys from people you know don't view pdf using adobe reader, who don't browse the web (neither use flash) etc. And then still you also have to know that their email account password is reasonable strong .. So whatever this thread is about - its only about making it harder to intentionally inject bad code. Also signed by two people - how to verify that two accounts/email addresses really belong to different people? - You understand the problem. Anyway - having signed packages is good, because attackers will be slower, they have to build up trust first .. So it will improve the situation a lot. I also would appreciate being able to get hash sums from the 00-index.tar. Then automatic packaging is much easier. Oh - and don't forgett the huge amount of code hackage has today. It may not be feasable to trust - check all code - but having the most used code checked by multiple parties alreday is a great improvement. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Specify compile error
Is there a way to make it a compile time error?? http://en.wikibooks.org/wiki/Haskell/GADT It may pay off talking about your specific use case. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] hasktags - etags backend, any reason to not remove function arguments from tag files?
Hi list, hasktags -e generates lines containing the function arguments. For Example: f0 foo\x7f5,6 The foo is the function arg, not the keyword to be tagged. Emacs still finds f0, but it does not show it in tab completion using m-x find-tag .. I don't use Emacs myself. That's why I want to ask whether this is intention or a bug. The fix is trivial: use name of FoundThing instead of concat (take (token + 1) $ spacedwords fullline) Is there any reason to keep current behaviour? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hasktags - etags backend, any reason to not remove function arguments from tag files?
Excerpts from Herbert Valerio Riedel's message of Tue Mar 20 15:38:54 +0100 2012: [1]: http://en.wikipedia.org/wiki/Ctags#Etags_2 \0x7f and \0x1 record and pushed this fix. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] strict version of Haskell - does it exist?
Using insertWith' gets time down to 30-40 secs (thus only being 3-4 times slower than PHP). PHP still is at 13 secs, does not require installing libraries - does not require compilation and is trivial to write. A trivial C++ application takes 11-12secs and even with some googling was trivial to write. Excerpts from Felipe Almeida Lessa's message of Mon Jan 30 17:36:46 +0100 2012: Then please take a deeper look into my code. What you said that you've tried is something else. I didn't say that I tried your code. I gave enumerator package a try counting lines which I expected to behave similar to conduits because both serve a similar purpose. Then I hit the the sourceFile returns chunked lines issue (reported it, got fixed) - Anyway: My log files are a json dictionary on each line: { id : foo, ... } { id : bar, ... } Now how do I use the conduit package to split a chunked file into lines? Or should I create a new parser many json newline ? Except that I think my processJson for this test should look like this because I want to count how often the clients queried the server. Probalby I should also be using CL.fold as shown in the test cases of conduit. If you tell me how you'd cope with the one json dict on each line issue I'll try to benchmark this solution as well. -- probably existing library functions can be used here .. processJson :: (M.Map T.Text Int) - Value - (M.Map T.Text Int) processJson m value = case value of Ae.Object hash_map - case HMS.lookup (T.pack id) hash_map of Just id_o - case id_o of Ae.String id - M.insertWith' (+) id 1 m _ - m _ - m _ - m Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] strict version of Haskell - does it exist?
jsonLines :: C.Resource m = C.Conduit B.ByteString m Value jsonLines = C.sequenceSink () $ do val - CA.sinkParser json' CB.dropWhile isSpace_w8 return $ C.Emit () [val] Adding a \state - (the way Felipe Lessa told me) make is work and it runs in about 20sec and that although some conduit overhead is likely to take place. omitting my custom data type using bytestrings operating on Value of Aeson reduces running time to 16secs. PHP/C++ still wins: less than 12secs. Now I can imagine again that even a desktop multi core system is faster than a single threaded C application. Thanks for your help. Maybe I can setup profiling again to understand why its still taking little bit more time. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] strict version of Haskell - does it exist?
Excerpts from Felipe Almeida Lessa's message of Tue Jan 31 16:49:52 +0100 2012: Just out of curiosity: did you use conduit 0.1 or 0.2? I updated to 0.2 today because I was looking for a monad instance for SequenceSink - but didn't find it cause I tried using it the wrong way (\state - see last mail) I also tried json' vs json (strict and non strict versions) - didn't seem to make a big difference. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Exceeding OS limits for simultaneous socket connections
What you can try - reduce amount of threads running at the same time - thus accept less connections. AFAIK the OS has a buffer caching the connection request for a while - thus this may just work. Using STM it would be trivial to implement it: try incrementing a var, if it is 100 fail. It will only be retried if the vars change or such, correct? When you're done decrease the number. - increase limit (you said this is no option) - replace getContents conn by something strict and close the handle yourself? (not sure about this.) Eg yesod introduces conduits for that reason = http://www.yesodweb.com/blog/2011/12/conduits There are alternative implementations on hackage. - not sure how many apps are running at the same time. But instead of creating many connections from machine A to B you could try establishing a permanent connection sending binary streams or chunk the messages. Eg wait for 5 requests - then bundle them and send them all at once (depneds on your implementation whether this could be an option). That's all which comes to my mind. Probably more experienced users have additional ideas. Thus keep waiting and reading. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] strict version of Haskell - does it exist?
Replying to all replies at once: Malcolm Wallace At work, we have a strict version of Haskell :-) which proofs that it is worth thinking about it. Ertugrul If you want to save the time to learn how to write efficient Haskell programs, you may want to have a look into the Disciple language. Yes - I will. Its on my TODO list for at least 12 month :( Not sure whether there are parser combinator libraries yet. @ Herbert Valerio Riedel (suggesting aeson) I gave it yet another try - see below. It still fails. @ Felipe Almeida Lessa (suggesting conduits and atto parsec) I mentioned that I already tried it. Counting lines only was a lot slower than counting lines and parsing JSON using PHP. @ Chris Wong flag is that strictness isn't just something you turn on and off willy-nilly You're right. But those features are not required for all tasks :) Eg have a look at Data.Map. Would a strict implementation look that different? I came up with this now. Trying strict bytestrings and Aeson. note the LB.fromChunks usage below to turn a strict into a lazy bytestring. Result: PHP script doing the same runs in 33secs (using the AFindCheckoutsAndContacts branch) The haskell program below - I stopped it after 8 min. (At least it does no longer cause my system to swap .. You're right: I could start profiling. I could learn about how to optimize it.) But why? The conclusion is that if I ever use yesod - and if I ever want to analyse logs - I should call PHP from yesod as external process !? :-( Even if I had a core i7 (8 threads in parallel) I still would not be sure whether Haskell would be the right choice. I agree that I assume that all data fits into memory so that piecewise evaluation doesn't matter too much. Thanks for all your help - it proofs once again that the Haskell community is the most helpful I know about. Yet I think me being the programmer Haskell is the wrong choice for this task. Thanks Marc Weber my new attempt - now I should start profiling.. Looks like I haven't built all libs with profiling support .. import Data.Aeson.Types import Data.Aeson import Data.List import Control.Applicative import Debug.Trace import qualified Data.Map as M import Action import Data.Aeson.Parser as AP import qualified Data.ByteString.Lazy as LB import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as LBC8 data Action = ACountLine | AFindCheckoutsAndContacts -- lines look like this: -- {id:4ee535f01550c,r:,ua:Mozilla\/5.0 (compatible; bingbot\/2.0; +http:\/\/www.bing.com\/bingbot.htm),t:1323644400,k:XXX,v:YY} data Item = Item { id :: SB.ByteString, ua :: SB.ByteString, t :: Int, k :: SB.ByteString, v :: SB.ByteString } instance FromJSON Item where parseJSON (Object v) = Item $ v .: id * v .: ua * v .: t * v .: k * v .: v parseJSON _ = empty run :: Action - [FilePath] - IO () run AFindCheckoutsAndContacts files = do -- find all ids quering the server more than 100 times. -- do so by building a map counting queries (lines :: [BS.ByteString]) - fmap (concat . (map LBC8.lines) ) $ mapM BS.readFile files let processLine :: (M.Map BS.ByteString Int) - BS.ByteString - (M.Map BS.ByteString Int) processLine st line = case decode' (LB.fromChunks [line]) of Nothing - st -- traceShow (bad line ++ (LBC8.unpack line)) st Just (Item id ua t k v) - M.insertWith (+) k 1 st let count_by_id = foldl' processLine (M.empty) lines mapM_ print $ M.toList $ M.filter ( 100) count_by_id ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] strict version of Haskell - does it exist?
A lot of work has been gone into GHC and its libraries. However for some use cases C is still preferred, for obvious speed reasons - because optimizing an Haskell application can take much time. Is there any document describing why there is no ghc --strict flag making all code strict by default? Wouldn't this make it easier to apply Haskell to some additional fields such as video processing etc? Wouldn't such a '--strict' flag turn Haskell/GHC into a better C/gcc compiler? Projects like this: https://github.com/thoughtpolice/strict-ghc-plugin show that the idea is not new. Eg some time ago I had to do some logfile analysis. I ended doing it in PHP because optimizing the Haskell code took too much time. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] strict version of Haskell - does it exist?
Excerpts from Don Stewart's message of Sun Jan 29 22:55:08 +0100 2012: Summary; -fstrict wouldn't magically make your code good. No. you're right. I don't expect that to happen. I agree on it being always the programmers fault using wrong tools or not knowing the tools well enough to get a job done. The PHP code looks like this: foreach(glob('*.txt') as $file){ foreach(split(file_get_contents($file)) = $line){ $parsed_line = json_decode($line); // get some unix timestamps, keep some hashes of seen clients // (cookie ids) and such // check how many minutes before a checkout the customer visited // the site - and whether he did so for a couple of days. } } // print result The files are about 300 MB in size. However memory usage grew and grew and grew - I had to kill it or limit amount of files. The PHP code runs in a couple of seconds (parsing json and loading files).. the Haskell app took much longer. That PHP is fast is no surprise: I expect json_decode and split to be implemented in C. So yes - I used lazy lists. However 8GB of RAM should have been enough to keep things in RAM. So maybe also the JSON parsing library kept too many unevaluated things in memory. So I could start either writing my own JSON parsing library (being more strict) or profile the application many times - but I don't want to. Ignoring the json parsing I also gave conduits a try - only counting lines. I know its experimental - but from its description I concluded it would prevent me being a stupid Haskell programmer from taking too much memory even using bad Haskell code. However it looked like splitting the lines only counting them (recognizing utf-8 chars) took a lot longer than also doing the json parsing in PHP. Then the conduit implementation looked funny: hGetLine is used to feed a line each time ... (luckily - because the utf8-libraries don't provide nice ways to parse incomplete chunks of utf-8 bytes such as returning Either IncompleteMissingByte UTF8Chunk).. Probably the split(,\n) in PHP doesn't parse utf-8 chars - and luckily it doesn't seem to matter because \n only uses one byte. I know that I'm not an Haskell expert. I still got the impression that getting nice performance would be a small challenge and require much more time than I spend on the PHP version. That's why I'm wondering why there is no -fstrict option for such simple use cases because Haskell has so many optimizations other languages dream about. I mean lot's of non lazy language still get their jobs done. So it always depends on the use case. Isn't it easy to add a compiler flag to GHC adding those ! strictness annotations everywhere possible? Then simple use case like this would not be a huge challenge. Maybe you're right: I should just prepare some dummy files and ask the community to help. However optimizing the JSON parser and my code just seemed to be too much effort .. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What happens if you get hit by a bus?
What about just replying with this one link: http://www.haskellers.com/ As thumb of rule it takes half the time to review code compared to writing it (Don't remember where I read it ..). Thus even RoR can be a lock in and delay updates if stuff changes. The only chance is creating a team and provide services as team. But in the end its a matter of costs: If you have to share ideas - if you have to keep each other up to date it'll take more time and somebody has to pay for it in the end.. Its not only a Haskell vs RoR qusetion IMHO. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] DB vs read/show for persisting large data
Excerpts from Michael Snoyman's message of Wed Dec 14 14:34:30 +0100 2011: On Wed, Dec 14, 2011 at 3:31 PM, C K Kashyap ckkash...@gmail.com wrote: Definite *don't* use read/show: if you make any updates to your data structures, all old files will be lost. Well you can work around it: data MyDataV1 = { name :: String } deriving (Read,Show) then you make an update: data MyDataV2 = { name :: String, age : Int } deriving (Read,Show) then you can do let (v1 :: MyDataV1) = tryReadDataToMaybe data let (v2 :: MyDataV2) = tryReadDataToMaybe data let real_data = upgrade v1 `or` v2 But you already see that you start writing boilerplate code. It can be done for easy data structures .. But it soon will be a night mare if you have complex data. If you use a version control system you don't loose your data - it will just be hard to update. For prototyping deriving binary or read/show instances are a nice way to get started. serialization to JSON/XML can be implemented later when you change your data format as well eventually. So it depends on your task. If you want to use read/show etc you have to think about file locking and such. Have a look at the derive package (hackage) which can derive more instances than just read/show (eg json). You can still use a sqlite database use it as binary storage... Depends on whether all your data fits into memory. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] capri cabal-dev virtualenv cab
nixos.org (eg hack-nix) addresses those issues (but may introduce some more less important ones). You can setup multiple project specific build environments easily. If you're interested contact me on irc.freenode.net or by mail. (nick MarcWeber) I don't know the other solutions so I can't comment on them. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there still at list of active Haskell projects
Excerpts from Vasili I. Galchin's message of Sat Sep 24 23:42:06 +0200 2011: On http://www.haskell.org I didn't see a list of active Haskell projects. ?? What do you mean by active ? Some packages such as hasktags - are they dead? I still use it. However there have not been much updates recently. Eventually you're looking for hackage.haskell.org? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: lushtags, haskell ctags for Vim Tagbar plugin
Hi Bit Connor, I like very much that you've also listed related work. Would you mind comparing the tag generation engine with the solutions you've pointed out? Eg does it depend on ghc? Does it reuse one of the existing solutions for generating tags - eg is it a wrapper only? Eg hothasktags says with knowledge of import lists and qualified imports. It provides a smart go-to-definition for vim Did you know that taglist plugin for Vim should also automatically regenerate tag files for the current buffer? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Ur tutorial, and a challenge
Excerpts from Christopher Done's message of Wed Jul 27 12:26:08 +0200 2011: Is TemplateHaskell fair game? Because if so these problems are not hard. Yesod employs static typing for templates. HaskellDB achieves injectionless static type checking even without TemplateHaskell, and templatepg has type safe SQL queries based on parsing the SQL itself and inspecting the types involved by asking the PostgreSQL server directly at compile time. Which doesn't work because the result of querying is not accurate enough (or has not been in the past?).. Eg see here - Only DB2 seems to return usable results. http://www.haskell.org/haskellwiki/MetaHDBC The main problem is: Does a field return a nullable value (thus Maybe?) However if that changed I want to know about it :) If you know databases inside out than you also know that its sometimes faster to run a sophisticated custom query than doing all the work in Haskell (after sending data over network). Don't think HaskellDB supports all of those features. I imagine that its easier to extend urweb in this regard. However there are a lot new SQL based Haskell libraries I don't know yet. The difference is that Haskell's type system is bad at creating temporary types unless you go the HList route? http://hackage.haskell.org/package/records Does this library address this? While Haskell's type system is known to be touring complete this doesn't mean that such code is easy to maintain. I'm no longer up to date so all I said may be partially wrong :( Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Vi mode in ghci?
You can also get vim-addon-async [1] and run ghci inside Vim. Then you can use all Vim goodness. [1]: requires client-server. Tested on Linux and Mac http://github.com/MarcWeber/vim-addon-async Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Further installation adventures
Excerpts from Jacek Generowicz's message of Mon May 23 19:15:53 +0200 2011: Where should I be looking for the relevant config.log? Maybe you're missing header files? is there a readline-dev package for your distro? also open the cabal file and watch for include or library directorie settings. Maybe they don't fit your distro. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using cmake with haskell
Excerpts from Robert Clausecker's message of Wed May 11 21:54:32 +0200 2011: Because I want to get a good answer, I cross post it here. It may be interesting: If you do this you should consider adding a reference to this thread on stackoverflow as well .. You can read this mailinglist online (haskell.org - mailinglists or such) why cmake? + maybe some paralell compiling possible (that's a make feature) - ghc has to be run once for each file (slow down) cabal is a standard. And we all like it for that. It makes packaging all the libraries for nixos/gentoo/debian/... a *lot* easier. Not everything which can be done should be done as well. Think alone about all the dependency handling done in cabal. There is no need to duplicate this all. So the interesting question would be discussing which parts of your projects are in C for what reason. Then you should consider raising this question again if cabal can't be made compiling those view files easily. If you know what you need its also a good time to ask again for other projects having already solved build tasks like this. If you're looking for work to learn something new and to get your hands dirty join darcs, yi, .. or such. Sourceforge projects can even flag themselves as need help at Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Local copy of hackageDB
Local copy ? You know that hackage is hosting several thausands of source archives - also old versions you don't want? Do you want to mirror everything locally? Fetching latest versions only to generate hashes takes many hours. (Experience from hack-nix). Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ghci Vim completion within Vim - need some advice
Hi, https://github.com/MarcWeber/vim-addon-async implements a hacky way to run external processes asynchronously. An external helper application send stdout of the process to Vim which adds the bytes to the buffer. Its not perfect but quite usable. Now I'd like to show the completion of \t sent to ghci to the user. I've done so for Ruby, Python and Scala: Vim sends input to ghci, and the reply is catched and put into Vim's completion list. issue 1): ghci's tab only works if its connected to a terminal. This can be fixed easily by using a pseudo terminal issue 2): ghci's prompt sends data to /dev/tty (the controlling terminal) rather than to stdout/err. I don't know how to fix issue 2). Any ideas? The result could look like this python REPL screenshot: http://mawercer.de/~marc/vim-addon-async-python-repl.jpg Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] groupBy huh?
Excerpts from Jacek Generowicz's message of Fri Mar 04 00:18:07 + 2011: Prelude Data.List groupBy () [1,2,3,2] [[1,2,3,2]] This is wired. However if you think about the algorithm always using the first element of a list and comparing it against the next elements you get 1 2 ok, same group 1 3 dito 1 2 dito Thus you get [[1,2,3,2]] Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] type safe web forms at compile time Was: Re: Ur vs Haskell
Excerpts from Alberto G. Corona's message of Wed Mar 02 20:53:28 + 2011: Some time ago I forgot to forward this message to thie ur versus Haskell http://www.haskell.org/pipermail/haskell-cafe/2011-January/088060.htmldiscussion, (as usual) --- The most impressive feature (of ur) is the compile time checking of conformance between the form and the form results. This can be done in See WASH (- hackage). So there is a Haskell implementation. There are small differences though: urweb has nicer URLS which should be much more SEO friendly. From my point of view its not only about forms. Its also about checking SQL queries. And urweb seems to do this very well. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there something better than tags?
Excerpts from Magnus Therning's message of Tue Feb 22 11:45:34 +0100 2011: generate them, and there are two tools for it, hasktags and hothasktags. haskellmode currently uses GHCi to generate tags. However, the limitation seems to be inherent in the tags format itself. AFAICS there is no way to get a fully functional go-to-definition with that format. learn about gd and gD those are not perfect though. Also keep in mind that # * start searches on words. They all are not language aware so they are only bad replacements for what you're looking for. If you compile with warnings doesn't ghc emit warnings about shadowing ? If so names tend to be unique such those searches tend to be helpful. 2. Retrieve type information for local defintions ('let', 'where', 'do'), and ideally also for sub expressions (like ':t filter (== 1)'. I believe haskellmode uses GHCi to get the type information out, but I only know about scion which comes closest to what you ask for. (http://github.com/MarcWeber/scion-backend-vim) Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there something better than tags?
Excerpts from Peter Hercek's message of Tue Feb 22 14:54:53 +0100 2011: Is this a correct summary? If nothing changed then yes. I didn't follow most recent development of scion. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] community server hasktags learned recursing into directories
hasktags learned about how to recurse into subdirectories itself. This is especially useful for windows because writing scripts can be done but is less well known (http://stackoverflow.com/questions/4865391/answer/submit) Now I'd like to push the latest changes to the community server which was hosting the repo in the past but my account does no longer work? Also there are some dead links now. Eg http://www.haskell.org/haskellwiki/Haskell.org_domain still references http://community.haskell.org/admin/ (404) Do you know what happened and where I should host the repo now? (uploading it to github would take seconds only) Moreover I fonud that I was no longer subscribed to haskell-cafe. I can't remember having unsubscribed ? Let's hope this mail get's through now after having resubscribed. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ActionScript Byte Code backend ?
Excerpts from Aaron Gray's message of Tue Nov 09 18:40:47 +0100 2010: Is there a Flash ActionScript Byte Code generating backend for Haskell ? I know there was an older SWF 3 backend :- http://www.n-heptane.com/nhlab/repos/haskell-swf/ But is there anything more up to date ? There is another reference project: HaXe (its not Haskell. But it targets Flash 10) In theory AS3 is very close to JS. So the experimental JS targets could be a solution as well ... Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haskell at bettercodes.org
Excerpts from Ertugrul Soeylemez's message of Wed Sep 22 21:57:32 +0200 2010: Even though I'm being made fun of, Gwern is actually right. When coding I sometimes find it much quicker to use some text browser or in-editor browser to look something up. Developers shouldn't be denied doing that, because development doesn't need fancy eye candy. As said, JavaScript /support/ is fine, but JavaScript /requirement/ isn't. But that's just my humble opinion. You can have both: www.heindke-bis.de is a page I created for a customer. The trick is to add the JS candy enhancements using JS only. Then you can enhance the interface by adding onclick attributes etc. But its still browsable by elinks and search engines by using usual href attributes. If you think about it you may find a solution which satisfies both needs. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] can Haskell do everyting as we want?
Hi Qi, have a look at brainfuck language. Its turing complete as Python, Haskell, etc are. Then you'll learn that the quesntion Can I do everything possible is not at all important. You have to ask instead: Can I complete my task in reasonable time and with reasonable runtime performance etc. For most use cases Haskell is a good choice - the only real things I'm missing are - nice stack traces - completion support - because I find it relaxing not having to looking all names. This could be fixed to some extend though.. If you want to target JavaScript in browsers I'm not sure whether Haskell is the best fit either. If I were you I'd learn some Haskell - I don't think you'll regret it. By reading the mailinglists, joining the chat room ocassionally you'll learn a lot. But if you have a real task to solve - have a look whether existing solutions exist - thus Use the best tool for the given problem. Because recoding can sometimes take longer. And eg the Java community has been much bigger in the past - thus there are more libraries available. Eg Haskell has no htmlunit yet which interpretes JavaScript and simulates a headless browser etc. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Suggestions for an MSc Project?
Excerpts from John Smith's message of Sun Jul 04 10:43:17 +0200 2010: My MSc requires a project dissertation, which is expected to take about 800 hours. I would like to work on something which is of use to the Haskell community. Any suggestions? IMHO You'd make many Haskellers happy if you'd start writing something like db4o in and for Haskell. Its like a transactional database operating on objects. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bug in ghci ?
Hi titto, You should try to give a complete list of steps which can be run to reproduce your problem. This also includes ghci --version output and maybe some info about the OS you're working on. So how you you load the code into ghci? Using ghci File.hs or :l ? In any case you want to declare the show method: -- yes, I know I should just use 'deriving (Show)' because most -- developers expect Read Show instances to work the common way -- which means they serialize and unserialize data types in a reliable -- way ... instance Show Test where show (Test s) = my show implementation of Test: Test ++ s Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Talking to Java from Haskell?
HI Dan, It depends on how much of the protocol you're going to use. If you only have to use some kinds of messages it may be fastest to use Scala and Actors using the Java library. Depending on the data I'd use a very simple protocol for the communication Haskell - Scala. Whether you should reimplement the protocol also depends on whether speed is an issue. If nobody picked up and started to work on Java interaction I think you're right that b is the fastest option. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is Haskell unsuitable for?
Hi Aditya Siram, - maybe shell scripting: running ghci takes longer than starting bash. Compiling is not always an option because executables are bigger than shell scripts or C executables Haskell could be the wrong choice if - an existing solution exists which does the job and you know you're not going to patch the source ( eg OpenOffice or Linux kernel, or simple build scripts. There is already make etc ) - want to run your app on targets which are not supported by Haskell or not supported too well. This includes Client scripting on browsers. I also think selling web apps which should run everywhere. If people read PHP they know how to install it. If they read Haskell I doubt. So if you want to sell apps to average mainstream custsomers Haskell can be a bad choice. - you want to collaborate with people who don't know the language I think you should go the other way round: Pick a task and ask which is the best tool to get the job done. But I think those items are obvious. Of course this is my point of view. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Harder than you'd think
What I ended up writing is this: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=25782 lookup :: KeyID - Key - Container - Maybe Value Does anybody have a less-insane way of doing this? Sure: type MyMap = Map (KeyID, Key) Value Don't use multiple keys. Put the keys into a tuple and use that as key. Let me know whether this is what you were looking for. I tried writing something like this. Yet SQL gives all this stiff for free. I still wonder which is the nicest way to express this data in Haskell without coding everything yourself.. Yours Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Harder than you'd think
Excerpts from Jeremy Shaw's message of Sun Jun 13 19:16:02 +0200 2010: Hello, My idea for solving this problem was to try to use something similar to a kd-tree. I have a proof of concept for 2 keys here: http://src.seereason.com/haskell-kdmap/ But, to extend it to an arbitrary number of keys may need template haskell. I tried this. TH changed a little bit so it may be broken. I mapped multi keys to Data.Map Key1 (Data.Map Key 2) http://github.com/MarcWeber/rdmhaskell/ I gave up the project that time due to lack of time and because spending so much time on this project was not worth the time because Postgres and MYSQL already did what I was looking for.. The idea was to model kind of database because I wasn't satisfied with IxSet that time. line 50 shows how to define a combined index on two fields: http://github.com/MarcWeber/rdmhaskell/blob/master/test/TestCase.hs I'm not even sure whether I should recommend reading my code :) All I want to say: Its a little bit of work which is highly appreciated by many Haskellers IMHO. If you start such a project keep posting updates to the list. I'll read them. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to browse code written by others
Excerpts from Martin Drautzburg's message of Sun Jun 13 22:32:18 +0200 2010: Anyways, how do you guys do it, i.e. how to you dive into non-trivial foreign code? I use Vim and tag files generated by Vim. Using gnu idutils or such you can find any occurences of words very fast in large code bases. Of course they are not language aware but they often get the job done. I'd like to share all my scripts. Write me an email if you're interested. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Similarities between web programming and functional programming
Excerpts from Nilanjan Raychaudhuri's message of Sat Jun 12 22:09:33 +0200 2010: Hi all, As a newbie into functional programming and especially Haskell I am curious to know how functional programming style fits into building web applications? And how it compares to building web apps in Ruby or Java. You may want to pay attention to - RAM usage (How many applications can you deploy on a single server) - time required to prototype an idea - how likely is it to get errors? Ruby, PHP, Python are more likely because they are not statically typed as Haskell. - If there is an error / Exception how easy it is to track it down? Ruby, Java, PHP, Python.. may win here because you have stack traces. However I bet errors are much more likely to happen - features: - eg run your own server to keep state. (PHP can't do this unless you use a database. Putting chat messages into a database can be done but adds latency.) - eg shared transactional memory is a great feature. However you have to code much logic yourself which RDBMS do automatically if you add some keys and constraints. I'd add both Scala and HaXe to your list of interesting languages (I don't have to add Haskell here) Scala has many nice features of both: Haskell, Ruby and Java. HaXe is unique because it can target many backends. It translates to JS, Flash, PHP, neko, C++, .. About Haskell there are different papers. One is about the web framework WASH, another is about HSP, .. Use the search of haskell.org and search hackage. The haskell wiki is a great resource. Don't miss it. haskell.org will tell you about the Haskell mailinglist which is dedicated to web development only. Comparing different languages (and frameworks) is no easy task. So good luck. Two years ago I left a company (well I only was there for about 2 month) because developing web apps in Java seemed to be cumbersome to me. However things may have changed. Today you can also translate Java to JS etc depending on the framework. If you give more details about what you're up to you may get more relevant replies. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal -j
Excerpts from Christopher Done's message of Fri Jun 04 00:39:23 +0200 2010: On 4 June 2010 00:05, Don Stewart d...@galois.com wrote: wasserman.louis: What, if anything, stands in the way of parallelizing Cabal installs, make -j style? Parallelizing ghc --make   http://vimeo.com/6572966 Unless Louis meant what's stopping cabal-install from installing dependancies in parallel instead of serial? In which case; nothing? I think cabal-install compiles Setup without starting ghc or such (I may be wrong). This would be fixable. If you want to volunteer try hack-nix. It's based on the Nix distribution system which provides this feature natively. You can even ask others computers to help building dependencies quite easily. Downside: At the moment it will pull all depndencies (including kernel headers and glibc..) if you install it on a common linux system. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: The state of Hackage: what are we doing about it?
Excerpts from Don Stewart's message of Tue Jun 01 01:13:20 +0200 2010: I see fairly regular complaints about too many Haskell libraries, bewildering choice of difficult-to-determine quality. I want to send a small reminder that there was the idea adding a public wiki for each project which can react upon wishes of users faster than everything else: http://haskell.org/haskellwiki/Hackage_wiki_page_per_project_discussion Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] darcs to mercurial migration
Hi Günther, tehre is a fast darcs to git tool. Maybe you can convert to mercurial easily then. Ping me on irc (MarcWeber) or write back if you're interested. I'll digg the link up then. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Abstracted File Library?
Excerpts from Kazu Yamamoto (山本和彦)'s message of Tue Apr 27 04:59:46 +0200 2010: Hello, I'm implementing a command which manipulates files both on Unix/Mac and Windows. I was very surprised because there is not getStatusChangeTime function. So, I wrote it with CPP. http://github.com/kazu-yamamoto/Mew/blob/master/bin/hs/Stat.hs Another problem is that since '\\' is used as the file separator of Windows, I cannot use regular expression naturally for file path. In Clarify this, please. Used by who? The user may enter \\ which is valid on Windows. Both Cabal and filepath libraries do have functions operating on filepath strings. Eg filepath can split them. I agree that / is valid on Windows. So before working on user input you have to sanitize paths by replacing \\ by / Are there any abstracted file library to solve these problems? Or should I start to write such a library? Which functions should this library have? I'm pretty sure that filepath already has most functions you need. You may want to patch it so that it's using / on Windows when assembling paths form lists of directory names. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Abstracted File Library?
Hi Kazu, I don't have a ghc Windows installation at the moment so I can't test. filepath has functions such as normalise and equalFilePath. Have a look at splitPath which is using pathSeparators which allows both \\ and / on Windows. filpath is using \\ to join pathes though. So appling normalise on filepath on Windowsn will result in having paths containing \\ only. This will still not help you writing your regex unless you replace / by \\ on Windows. It's easy to write [\\/] in regex to catch both. So maybe a normalisePosix function should be added which always returns / ? The fast way which would work for you only is making pathSeparator return / only. Then you're done but your code will not be portable.. Including a local copy of filepath for exactly this reason could be an option for you. isSymbolicLink, linkCounts, etc. Don't know about them.. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: Agata-0.2.0
If this is to be used with QuickCheck maybe it should be named that way. eg quickcheck-agatath ? This way its found faster. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hsql repository
Hi Daniil Elovkov, AFAIK Nick patched HSQL the last time. However he hasn't had time to submit its changes to the repository. So currently the Hackage version is more up to date than the repository. HSQL is hosted on the Haskell community server: http://code.haskell.org/HSQL/ Best way to continue: Get hackage version. Copy the mover into the darcs repository. Ask Nick (Jörg Rudnick) whether he wants credits. Make a darcs commit giving it a message such as fix some extensible Exceptions stuff. patch provided by Joerg Rudnick and continue HTH Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage accounts and real names
Well, Is the real name uniq enough? I mean if I google for Marc Weber many Haskell related posts show up. So yes, this is me - but there are also many false hits. So I for my part do no longer trust google results if I want to judge a person. It gives some hints - you can verify by asking the person. Different case: What happens if someone else chooses a pseudonym which happens to be your real name? Do those people change their real name then? I don't think you can protect against everything Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Are there any web server framework ?
There is a dedicated mailinglist about this topic, see below. There is a little bit more traffic the last days. If you have a look at hackage you can see that there are some frameworks. WASH is still missing. I'm going to change that though. Have a look at http://haskell.org/haskellwiki/Applications_and_libraries - Web, HTML, XML This was recently announced on the http://haskell.org/haskellwiki/Web_Projects http://haskell.org/mailman/listinfo - web-devel But there is no Joomla or Plone yet. Also I feel that database libraries don't have the level of some ORM libraries (such as Sequel (Rbuby) or SQLAlchemy (Python) ). But much work has been done already: There is/was an Apache module. There are variuous (F)CGI bindings and there is happstack: a sandalone web server. There is also a compiler backend creating translating Haskell into JS. (Don't know whether you want to use this in real world applications though). Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] compiler management for Haskell a la RVM?
I wrote it: It's called Hack-Nix and utilizies the Nix repository manager. I've added a wiki page to haskell.org some time ago. Drawbacks: Right now it doesn't make sense to include all hackage packages because resolving dependencies would never end because its written in Nix language. I can show you how it works if you're interested. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] a poorly thought out suggestion for cabal and packages that have lots of instances
Hi Jeremy A fourth option is to create a new package which contains just the instance. For example: syb-with-class-text I may be mistaken - but can't you just put the instance in a module (within syb-with-class) and make syb-with-class not import it by default? Why do you have to create a new package? Is there something I've missed? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] a poorly thought out suggestion for cabal and packages that have lots of instances
Excerpts from Ivan Miljenovic's message of Tue Mar 16 01:53:13 +0100 2010: On 16 March 2010 11:50, Marc Weber marco-owe...@gmx.de wrote: I may be mistaken - but can't you just put the instance in a module (within syb-with-class) and make syb-with-class not import it by default? That would still require syb-with-class to depend upon Text, etc., which is probably not a good thing to do. Doh. I've missed it. Sure. I think MissingH has similar trouble: You only want to use one or two features - but you have to install all dependencies. Three choices: a) add dependencies to syb-with-class. You could even think about refactoring text and split it into text-types and text-implementation. This way adding a dependency isn't such a big change. But it still is bad because syb-with-class maintainers in general don't want to align their changes with text updates. Neither do they want to fix problems arising from changes in all those packages it should provide instances for. Usually maintainers ask for splitting off such code. (vim backend for Scion is one case ..) On the other hand the Firebug people chose to align releases of core Firebug plugins to enhance stability and user experience. Anyway this is what some packages do. Eg Vim *does* contain many gui backends. You can't download a vim-common shared library and install vim-gui-gtk vim-gui-... There would be too many combinations. Package maintainers have stripped them down to vim-tiny vim-gui-with-X-huge-features ... or similar. But it's easy in this case - no (?) application depends on Vim. b) using conditional compilation usually package writers writing package descriptions for distributions such as gentoo, Debian just compile all backends. I think Debian always enables both: gnome and kde. Adding use flags to gentoo for each feature would be overkill. So in the end this is equal to a) (IMHO) I can not even estimate the amount of work it requires to make packaging tools cope with conditional compilation. You have to start propagating features to base packages etc. I think ivy claims to solve this kind of issue partially. (I don't know it that well) c) add many additional packages The problem is that it seems like this might really clutter up hackage? The way to go is improving tools (Hackage, IDEs, cabal-install) to cope with this situation. I'd even propose renaming the extra package to syb-with-class-text-instances. Then everybody can see what it contains. tools such as cabal-install will have more trouble to find a solution because there are much more possible solutions to take into account. One way to cope with this is always use latest version and fix broken packages.. Last but not least it is also a marketing issue: Eg OpenERP vs Adempiere: OpenERP is said to have *many* plugins. But some of them just add some DB fields or make a field have more characters. Adempiere contributors tend to call this a localization of their software. (You can read this up on their sf forums :) ) But I don't think anybody really cares whether we have 3000 or 5000 packages on hackage. In the end we all care about getting things done. Installing 20 packages and running cabal 20 times more often does matter. So what is correct? I don't know. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] ANNOUNCE: Bravo-0.1.0
Hi Matthias, Bravo is inspired by the PHP template engine Smarty and the Haskell Smarty is also about caching. Can you say whether your library support kind of caching as well? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal dependency hell
Hi Maciej, that's why I started hack-nix. You can patch dependencies easily. However you have to install the Nix package manager. It also works with lates versions only because the dependency solves is written in Nix itself. Which package is causing trouble to you? We can't expect package maintainers to test everything. So it must be people like you and me who fixes those changes. The way to go is make hackage allow changing constraints on the fly notifying the author that he can update his repository. This will work in most cases. Bumping versions because a dependency has changed is bad as well. This will cause to much overhead (and it dosen't solve the problem because the old package is still wrong). Specifying dependencies must be decoupled from bumping versions. It's because dep specs do depend on the world which can change.. At least that's what I think. If you're interested in Nix and hack-nix I can show you how everything works using an SSH session. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Books for advanced Haskell
Excerpts from Stephen Tetley's message of Mon Mar 01 16:54:57 +0100 2010: Hi Günther For advanced programming with no special attention to monads, there is 'The Fun of Programming' edited by Jeremy Gibbons and Oege de Moor, contents in a funny tab-box on this on this page: http://www.palgrave.com/products/title.aspx?PID=265581 The Haskell 'maths' books - 'The Haskell Road' (Kees Doets Jan van Eijk) and 'Discrete Mathematics Using a Computer' (John O'Donnell, Cordelia Hall Rex Page) - aren't guides to advanced language features, but they take somewhat vanilla functional programming (no monads, no type-classes) quite a long way. Whatever pointers may appear here they should be put on the Haskell wiki for future reference. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Bug#570284: O: washngo
Excerpts from Joachim Breitner's message of Thu Feb 25 10:15:08 +0100 2010: Hi, Am Mittwoch, den 17.02.2010, 15:35 -0600 schrieb John Goerzen: I no longer use WASH, nor do I have time to maintain it anymore. Orphaning it, and CCing debian-haskell in case someone there has interest in it. we have two option: Taking it over by the Haskell Group, or dropping it from Debian. Therefore my question: Is anyone using Wash? Is it still useful, three years after the last change and with HAppS around? It's a nice piece of code. I'm not using it either. But its ideas should not be forgotten. What exactly is the problem with supporting it? It's not using many extensions so compiling it should not make any trouble, does it? Maybe someone (I?) should write a .cabal file and add it to hackage. Then everyone who is interested in it can install it using cabal-install. I never want to miss having read some of its code. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Bug#570284: O: washngo
Hi, It compiles even with ghc HEAD with very minimal cabal adjustments. I will upload it to hackage soon. Whether it is a debian package or not isn't that important (IMHO). Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How can i run darcs in ghci?
Any help on how to load the .h is greatly appreciated. I tried -i with path to the src directory but it didn't work (should it?). Try -I -i is used for .hs files only (?). I am also very curious how others approach a new code base. What do the you do to figure out an implementation? ghci offers a debugger. I haven't used that much yet. If things are a little bit more complex I don't use ghci. I use ghc to call the code I'm interested in. This way my memory :-) doesn't vanish. If you stop ghci things are gone. Yeah, you can copy paste code into an editor.. Sometimes the only way for me to understand code is spending hours reading it. However I'm not sure whether you can get to know code that much faster. Afterall it depends on your goals. What do you want to do with darcs? There are some papers as well. You should also know that there is a darcs (devel/users) mailinglist if you're stuck that's the appropriate place to ask questions (or try irc) Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How can i run darcs in ghci?
What am I doing wrong? I don't know exactly. What's your use case? You should be able to load the darcs library into ghci without problems. Maybe this is good enough for you? impossible.h is located in src. So looking up ghc flags about how to to pass -I flags to CPP should be enough (?). Another way to find those flags fast is running ./Setup -v3 which will output the ghc commands cabal is running. HTH Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Virus alert while installing happstack
Hi Maciej, Several open source projects suffered from false positives. Usually you sent the file to the company having written your Virus detection application for review. It may be a Virus. However it's very unlikely. If you're in doubt you should compile from source and also check the source which was used to compile ghc .. etc. I want to say if you really want to be secure the amount of work is infinity. So I'd sent the file to AntiVir. Then I would go one ignoring the warning (If it *is* a Virus don't make me responsible for any damage - you never know.) I just tell you what I would do. Maybe delete the file and redownload it to make sure that it wasn't modified while traveling through the net? You can also paste the md5sum of those executables. Maybe someone else can verify them easily. Good luck Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Anyone recommend a VPS?
I'm a happy linode customer: http://www.linode.com/ Me too. I tried different hosting services before. They all have there strength. The linode shell is terrific! If all you want is standard debian or such it does'nt matter. However I tried installing NixOS Linux and I've had lot's of trouble until switching to linode. NixOS was up and running within 30min then.. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hsql won't install due to system.time
add old-time-1.0.0.2 to the _end_ of the build-depends line: cabal: haskelldb-hsql-sqlite3.cabal:7: Parse of field 'build-depends' failed. This is a cabal issue. Get a newer cabal and retry. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hsql won't install due to system.time
Hi Brian hsql is compatibel with most recent ghc yet. You can get patches for the .cabal files here: http://github.com/MarcWeber/haskell-nix-overlay/tree/master/patches/ However the Exception handling has to be rewritten as well. I wanted to fix this issues for weeks - No time. Let me know if you start working on this. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hsql won't install due to system.time
Hi Brian You _really_ don't want me working on anything, trust me. Hopefully some fine Haskell hacker who would also like to use hsql will volunteer. You make me smile. I learned Haskell for the same reason. Don't trust me but trust Haskell *kidding* If you want to work on it I can help you getting started. We both will benefit. You can contact me on irc.freenode.net anytime (nick MarcWeber) Of course If you're interested only in running some small queries you should just use PHP or another language of your choice :) Of course if you have some patches try them first. That will be faster if that works Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Language simplicity
As you can see, this conclusively proves... something. What about brainfuck? 8 different signs are used. - http://de.wikipedia.org/wiki/Brainfuck#cite_note-0 The first link points to a page saying there is an interpreter 98 bytes in size.. What does this prove? :-) Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] status of wash?
Hi Günther, the ideas of WASH will never die. However AFAIK the implentation has never been updated to work with servers such as HappStack. I may be wrong about this. I tried making WASH perfect by getting 100% DTD validation: http://github.com/MarcWeber/vxml Somewhen I was lost in the type system. I also noticed that I don't want 100% validation because this actually means you can't write ul /ul Because the XHTML DTD does't allow empty uls. It's not a big problem though. It's not ready to be used. That's why I didn't even upload it to hackage. I'll watch this thread and I'll see who can give more information. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What about adding a wiki for each haskell project?
Excerpts from wren ng thornton's message of Sun Dec 13 13:54:04 +0100 2009: Ketil Malde wrote: wren ng thornton w...@freegeek.org writes: Using a wiki page for each project enables anybody to add comments.[...] I think this is a great idea. Because of Duncan's concerns about imposing too much burden on authors, and because there are many mature projects which already have wikis etc, I have a counter-proposal. I don't this this is the same thing. Marc's proposal would provide a scratch pad for random users to discuss or comment on various stuff on Hackage. At least the way I see it, it is primarily *not* for use by the author, and in fact most useful when the author is not around to actively support his project. But if it's a wiki, wouldn't people be able to add changes themselves? Isn't that the idea behind wikis? Sure, the authors could lock down their wikis, but I don't get the feeling that many would. My interpretation of Duncan's concern ---not meaning to put words in his mouth--- is that adding a Hackage wiki could place undue burden on the authors. If authors already have a wiki, then a Hackage wiki is just an extra place to check for feedback which will be prone to duplication and being out-of-date. Indeed I didn't want hackage to host the wiki. I only want hackage to host the link to the wiki page. If this burden exist can we make it smaller by using a wiki which can send emails to the author (or the dev mailinglists) whenever there is a change? Then authors don't have to poll the wiki pages themselves. Anyway I feel this is going nowhere. The people which may benefit a lot are beginners. I learned that there are some maintainers who do follow Duncan's concerns. So let me start a last thread on beginn...@haskell.org. If they all say they fear outdated content more than they appreciate nice howtos or bugfixes which haven't been uploaded yet I'll forget about this idea and shut up. comparison to haskell.org/haskellwiki = Let's not forget that haskell.org is a nice source of information. It's a wiki as well. What makes haskell.org/haskellwiki (all other pages) that much different from what I propose? Let's wait and see what beginners think. Thank you very much for participating Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: What about adding a wiki for each haskell project?
Excerpts from Duncan Coutts's message of Sat Dec 12 03:26:30 +0100 2009: On Sat, 2009-12-12 at 01:00 +0100, Marc Weber wrote: hackage is success because: a) many (most) people do use it (by uploading packages) b) it is a comprehensive list of availible packages if not the most comprehensive one Duncan, can you write about your concerns briefly why some maintainers may dislike this idea ? I added a section to the wiki page you created. I didn't paste the link earlier because I was no longer sure whether a wiki page is the best thing todo. Anyway here it is: http://haskell.org/haskellwiki/Hackage_wiki_page_per_project_discussion Duncan added this section: 3 Concerns My (DuncanCoutts) concern is about the consent from package authors. Hackage is a social bargain. We ask package authors to distribute their work through hackage because it provides benefits to the community. If we impose too much on package authors then they may decide it's just not worth it. In particular, if we automatically create a wiki page for every package then we are imposing additional obligations on package authors. As a package author I might be concerned that this wiki page duplicates an existing home page or bug tracking system. If there's a wiki page about my project then I am effectively obligated to check it from time to time, since users will inevitably report bugs etc there. It is that extra obligation that package authors may resent. There is no problem with such a feature being opt-in, but whether it is something we require and impose on package authors needs much more of a social consensus before we go ahead. So how do we reach this consensus? Is it feasable to ask all package authors which uploaded anything to hackage? Duncan, can you also separate your thoughts and switch in two different roles: a) You as package maintainer (eg supporting cabal) b) You as cabal ( hackage) maintainer thinking about package maintainers contributing to hackage. Thus are you concerned yourself ? Would you prefer opt-in for the projects *you* maintain ? Do you think package authors which do care (and which have a bug tracking system and a home page (eg gtk2hs)) would be willing to add those links to the wiki? It could look like this: Dear user. Let me tell you about: * package bug tracking system (link) * package homepage (link) * package mailinglist (...) * package repository: darcs get . And people will follow those links and create a bug report. Moreover I think they would be even thankful! If they don't they are just stupid. And you'll always meet this kind of users.. And again: We generated value because you don't have to upload a new package to tell users about a new homepage or a new bug tracking system or whatever. They will find it by themselves without magic and without contacting you and without looking at the darcs repository (which may take much time ..) If you have time to maintain a package you also have time to ad 4 links or less. If you don't this means you don't care which is also fine. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What about adding a wiki for each haskell project?
Hi Antoine. One of the main goals is to have a place to a put information when you're not the maintainer. Of course I can put everything into *my* cabal files. I don't want to do this for projects I don't maintain. I'd like to ask maintainers first. But while this question - reply cycle is in progress I'd like to add a link to my patches. About darcs: Sure. Nobody want's to duplicate the contents of the darcs web page. However you can add a link to it. I wonder which is the way to ask all maintainers how they like this idea or more important: Why they might dislike having a wiki page others may edit as well. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What about adding a wiki for each haskell project?
Hi Wren, Thank you for taking the time for replying. Can you reread the wiki section labeled implementation details? I don't want hackage to be the wiki. I only want hackage to host a link to the wiki. There maybe reasons to host the wiki on hackage. Eg hackage does know when a package get's updated. Thus it could update some information on the wiki automatically. But it could do so on the community server as well. I proposed reusing the existing haskell.org/haskellwiki. If all features of the wiki are use its fine. The main idea is provide some minimal editable content so that you don't have to upload new cabal packages because of some small changes. One simple improvement to Hackage which would be nice and which would integrate well with community.haskell.org is if there were additional (optional) fields added to give urls for the wiki and task tracker separately from the main project homepage. EvanMartin asked for this wiki: field feature as well. Do you think changing the homepage field to contain a list would suffice? Or do you feel having an explicit wiki field is preferable? should have links to the wiki and tracker as well, but having direct links from Hackage would lower the cost for users to find out where they can post patches, comments, etc. Yes. That's one main point. Hackage is the entry point many users find. It's kind of standard. But hackage itself is too static. Uploading a new .cabal file is not the perfect way to add a link to a blog post or such. The easiest idea I came up was provide a link to the haskell.org/haskellwiki. The second thought I had in mind was Don't spend too much time on this. Anyway I feel this is important. So may I ask you to add the alternative that the community server can be used equally well to the wiki page? http://haskell.org/haskellwiki/?title=Hackage_wiki_page_per_project_discussionaction=edit Keep in mind that if we host the wiki pages on haskell.org they are found by the haskell.org search. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] What about adding a wiki for each haskell project?
hackage is success because: a) many (most) people do use it (by uploading packages) b) it is a comprehensive list of availible packages if not the most comprehensive one Duncan, can you write about your concerns briefly why some maintainers may dislike this idea ? Hackage is missing one feature: It is very static. I mean if you have a patch or a question or a comment you have to lookup the darcs repository, write the patch then contact the author and wait.. If the author replies everything is fine. If he doesn't you don't know what to do. And if he does your commitment still doesn't show up on hackage. Using a wiki page for each project enables anybody to add comments. I'm thinking about this kind of comments: Interlude doesn't work for me. It looks like the interlude.h file passes a tuple to the reportError function which doesn't expect a tuple. You can fix it by removing the , in the .h file. Try this patch: http://github.com/MarcWeber/haskell-nix-overlay/blob/master/patches/interlude-0.1.1.patch Of course I mailed the author. Looking at the package again I noticed that it was uploaded by someone else: GwernBranwen. gwern on #haskell told me that the author is responsive so I'll just wait some days, but others will try and fail as well. If the other person is new to haskell he may not find the fix fast. He just wants to know which of the heads is causing trouble.. Another use case would be users adding If you're interested in this topic also have a look at XXX Yet another use case is someone figuring out that function X was removed in version Y. He could than add a note x vanished since v.10 and everybody who wants to update cabal dependency constraints doesn't have to download the darcs repo to figure out that he should use package = v.10 . Of course contents of wiki pages may be totally wrong because the contents were written by people knowing the package less than the maintainers and authors. But everyone knows this and will take care. This wiki can server as fail over if the maintainer is on holiday. This wiki page will prevent people blogging about packages and benchmark results anywhere on the internet. So it's much more likely that this information is read and maintained. If you use google to look for bug fixes or such you may have success. But very often you end up reading pages dated 3 years ago which are outdated. This wiki page would be I simple effective way letting users annotate packages. Costs: Make hackage add one link. It would look like this: http://mawercer.de/~marc/hackage-link-example.jpg This link should point to the existing haskell wiki on haskell.org: http://haskell.org/haskellwiki/project-name-without-version Even if the maintainer is availible 24/h a day he won't upload a new minor version to hackage for each change. But maybe he'll paste a small note that the darcs repo is more up to date fixing issue x/y. You don't want to upload a new version because you added some documentation. Why don't you want to do that ? It's because hackage will keep every version which was uploaded once by design. Having 50 versions of one package just causes much more work for tools such as cabal install or hack-nix. Figuring out a solution to install all packages is hard enough. Maintainers can create the wiki page and subscribe to change notifications. So I don't think it'll be that much work for them to keep an eye on those wiki pages. How do you think about it? It's about centralizing information and saving your and my time. Many packages aready do have a wiki page. So why not make it easier for all to add one? Thoughts ? Currently my goal is updating some common packages so that they use extensible exceptions and base4. But when working on some patches I'd like to tell people that I'm doing so. I can't in an easy way. That's why I'm starting this thread. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Checking dependencies from C packages in cabal
Hi MaurÃcio, When pkg-config info is not available for a library (when I could Until you get the perfect answer you may want to have a look at the cabal definitions of zlib digest OpenGLRaw GLUT readline GLFW wxcore terminfo berkeleydb BerkeleyDB hubris pcre-light HDBC-mysql HDBC-sqlite3 HDBC-odbc HDBC-postgresql They all require additional C libraries to built. Also make sure to search the Cabal mailinglist and maybe even move this thread to the Cabal mailinglist. Eg just typing pkg-config and cabal into google revealed: http://markmail.org/message/aumw5ustnyrishvw There is a also a bug tracker for Cabal. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE managing cabal dependencies using nix and hack-nix
, zlib or happ alex have to be added manually once only. issues: nix will install its own glibc which dosen't cope with all kernels. You an use kind of native builds. I don't have experiences using them. I'm using nixos so I don't care anyway. speed: for speed reasons I propase only adding latest hackage packages. However you can have different databases or a filter can be implemented to disable certain packages to speed up calculations. Last resort: reimplement it in C putting code aside nix interpreter code. random notes: you can build many packages at the same time utilizing multiple cores using the nix-env -j flag of course many processes are started to build each package. So it definitely is a lot slower than using cabal-install which doesn't spawn processes for each cabal built. Maybe cabal-install and haskell-nix-overlay can be made sharing some patches. [..] If you're interested reply or contact me on irc to make me post about updates and major changes. Thanks for listening and for any feedback in advance. Marc Weber NOTES: [1]: Of course nix runs on cygwin as well. However nothing has been tested so quite some effort has to be spent making this work on Windows as well. [2]: If you have a dependency chain glibc - lib - executable ` - executable2 and lib got some security reinstalling executable will yield: glibc - lib - executable `- lib' - executable2 so you have to update executable to make it use executable2 as well. This all is done by putting each packgae into its own /nix/store/hash-name/ directory where hash is based on all build inputs. You can think about those hashes similar you do when thinking about git hashes. If a patch / package changes all hashes of depending packages / patches will change. If you want to have more details read about nix on the official homepage.G [3] hack-nix --build-env does a lot of stuff: - it reads the cabal file and writes a nix file containing the cabal contents - it creates more nix files in hack-nix-envs/nix Example: http://github.com/MarcWeber/hack-nix/tree/master/hack-nix-envs/nix/ I committed those so that you can bootstrap hack-nix. default9.nix is the nix representation of the cabal package. However the version has been changed to . This is done to identify your development version of this package. Thus default.nix wants to build this version: targetPackages = [{ n = hack-nix; v = 9; }]; hack-nix itself isn't built. But it's used to gather its dependencies. - then it realises that env derivation. Right now the solver will output many debugging lines to help you find out why it failed finding a solution. You can this off by debugS = false; [4] this can be done more convenient using scion. [5] help about nix: try #nixos on irc.freenode.net or its mailinglist. help about hack-nix: contact me on irc or by mail. I will try to keep the READMEs up to date. [6] At the first glance this sounds bad because: Each package can have different flag settings defining a different sets of dependencies. Each dependency declaration be satisfied by different versions of a package. So the amount of solutions to be inspected explodes. Nix isn't the best fit to write such a solver so it's quite slow. However limiting the ways a package can be built by - only adding latest package versions from hackage - setting some global flags (such as use base-4.*) seems to make the system fast enough for everydays use. I'm sorry that I didn't manage to find a better algorithm in reasonable time. If I had to say thank you to some people this list would include dccouts (for his support on Cabal), Saizan (who helped me by talking to me), the nix(os) dev team, nominolo (for his work on scion), and many others I don't even know about. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?
Excerpts from Peter Verswyvelen's message of Wed Aug 26 12:15:14 +0200 2009: Maybe it would be nice to agree on a standard datatype for keys? This might also include digital buttons on a joystick, etc... The synergy project (sourceforge) already does some mapping from Windows - Linux - Mac AFAIK. It forwards key input to the other system over network. This could be a source of additional information. However I haven't looked at the code yet. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Planning for a website
Excerpts from Colin Paul Adams's message of Wed Aug 19 17:13:14 +0200 2009: I'd much rather be using happstack's macid stuff, especially as I will have only very low usage, so i shouldn't have any scalability problems. See also this current thread: http://groups.google.com/group/happs/browse_thread/thread/961ab7cc28f1f91f Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] what about adding a HIDE pragma ?
I know about module Foo ( exportedFuncA, ExportedType(..) ) where exportedFuncA :: .. exportedFuncA = .. data ExportedType = ExportedType It's great that you can only export a subset of all functions defined in a module. However this kind of declaration causes some work when merging branches etc. Its not a big deal but takes time. So does it make sense to add this information using pragmas? {-# HIDE logInfo, logError #-} logInfo :: Int - String - (Bool, Double) logInfo = logM INFO this.module logError :: Int - String - (Bool, Double) logInfo = logM ERROR this.module Adding a pragma like HIDE, EXPORT is only a small change but can make a big difference in everyday life ? Can template haskell add those pragmas as well? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Debugging methods for haskell
Of course !! is only one cause for this kind of errror. Another is ghci head [] *** Exception: Prelude.head: empty list Unfortunately this kind of bug is very hard to debug due to the lazy nature of haskell. You don't have a stack trace as in Java, PHP, .. Example: data D = D String a,b :: [String] a = head [] b = head [] main = do let first = a second = b print first -- both will cause the same error but a different head caused the exception print second One solution is using interlude from hackage. I'm not sure wether it supports !! Also try this haskell-cafe search (you may have to up to page 20 or so) http://search.gmane.org/?query=empty+list+headauthor=group=gmane.comp.lang.haskell.cafesort=relevanceDEFAULTOP=andxP=Zempti%09ZlistxFILTERS=Gcomp.lang.haskell.cafe---A This reveals this thread for example: http://article.gmane.org/gmane.comp.lang.haskell.cafe/14921/match=empty+list+head http://article.gmane.org/gmane.comp.lang.haskell.cafe/6719/match=empty+list+head I recall there was another method. Yeah, I even found it (using ghci and set -fbreak-on-exception) http://donsbot.wordpress.com/2007/11/14/no-more-exceptions-debugging-haskell-code-with-ghci/ HTH Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] haskell.org: what can be improved causing what efforts?
(I wrote this two days ago.. unfortunately I missed that my new client didnt't sent it at all) Not wasting so much space on top for wiki space +1 competition to get a new design: +1, but is it feasable? Is there enough man power to implement it? Moving wiki content again? This is much more work than just embedding a new logo. code snippet: no hello world please. That's not a way to judge a language! But: a random haskell one line snippet with explanation would be cool. If a redesign causes too much work what about adding one eye catcher which everyone who wants to learn haskell will find immediately but won't disturb users who are used to the current design? Eg adding start learning / tutorial above Download Haskell would be enough. On that page you can tell the new user about everything (irc, mailinglists, ...) Another nice thing which could be done is adding a JS snippet scrolling down some pixpels so that the wiki header gets hidden. My comments about the design focusing on newcomers still preseving current content: current design: | TOP | | left sideright side | | LEFT BAR | | | | CONTENT | If you're not used to this kind of white is important design you end up reading these words: left side Haskell: great, but nonsense because you are already on this page. Do you ever click on that link? I mean removing part of the url is nearly as fast but less intrusive Wiki community: great. but missplaced. I'd move this link nearby Download Haskell ... Search on the left Recent changes: (*) Random page: (*) Special pages: (*) [ search ] [Go] [Search]: Why two buttons? What is the difference? eg even netbeans has only one ctrl-i search field for all: types, help, open windowsn right side: Not logged in, _Log in | Help ... Note: new account creation has been disabled as an anti-spam measure. (*) (*): No newcomer will care about these items. LEFT BAR (navigation) Search: ? A third way to do a search? Search haskell.org: a fourth way to do a search? History of Haskell: Who cares? I'm a new and I want to see wether it's worth learning haskell. I only care about the future! So this item should be below Future of Haskell Learning is most important. Where to get started ? Don't ask. Just click and start.. So I'd move those items that it looks like this (removing those two searches!) implementations: GHC, hugs, nhc98, UHC, Yhc, jhc, lhc learning: Why use haskell ? Haskell in 5 steps Learning Haskell Books and tutorials Wiki articles Blog articles and news Videos Wikibook Research papers the language: Language definition future history libraries (the user who is looking for libraries has started. he'll find this information because he'll look and pay attention) Standard libraries Hackage library database Applications and libraries Hoogle and Hayoo API search I'd reduce those 6 search only keeping two: SEARCHSite: [ ... ][wiki][go] img dice Code: [ ... ][go] [wiki] is a select allowing to choose a google search) Code: runs both: hayoo and hoogle search img dice = random page Comparison: How do other sites manage to put much content on one page? They only put enough and provide links. Some do even use DHTML. One example is xing ( a German business network ): http://www.buzinkay.net/blog-de/wp-content/uploads/2007/11/screenshot4.jpeg Neue Mitglieder = new users Kontakte meiner Kontakte = contacts of my contacts You only get a small list of items and can click on more Same applies to big companies such as www.gmx.de: They use DHTML and many tabs to hide information and only catch your eye by topics. Also note how the size of items changes (fish-eye like) when moving the cursor above the news items.. (below Blickpunkt) Don't get me wrong. I don't want the haskell page to look like gmx.de.. But this kind of tab style could be nice: | Events | Headlines | Recent package updates | recent wiki changes | * item * item or Events a) b) c) [+] Headlines a) b) c) [+] Recent Package Updates a) b) c) [+] Do you see that you can make the user be aware of all three headlines without having to scroll? Overall haskell.org is a great resource! Let's the value of its contens, please. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ORM for haskell?
And I realize that you are not trying to replace RDBs, just building a nicer interface to them. I am just concerned that some of the nice properties are lost in the process. I think my main concern comes from seeing people create databases, by automatically generating tables from OO-classes. They invariably ends up with something not nearly as nice, as if they had constructed the database in a more traditional fashion. To summarize, what you propose is cool. Just do not throw the baby out with the bathwater. Hi Mad. Maybe I want to replace a RDBMS. But this will cost. You can fire arbitrary SQL statements in no time at RDBMS. You can't do things like that that easy using a haskell (in memory) only solutions. So SQL wins here at the moment if you want to be productive. If you read the .pdf I posted you saw that SQLAlchemy is that coold that a) you can use the shortcut style and define objects and tables at the same time but you als can b) define both layers independent of each other. And: Most applications today don't have to scale to an extend forcing you to move all logic into a database system. If you can one request a sec on a web application .. That's already very much for most small shop system. (I'm not talking about Amazon or ebay or such!) I'm talking about customers who want some more customizations as you can do with oscommerce. My main purpose was to see wether someone else would be interested in spending more effort into such a solution. Anyway I have still have to do some other work before I can jump into such a project. And Mad, I think you already know that RDBMS are not the best solution because it's very hard to ask a RDBMS wether a query retuns a nullable value or not. And that makes a huge difference wether you have to use a unsafeFromNull like function all the time or not. Time will tell how much energy I can spend on such this topic in the future. cu all Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ORM for haskell?
Some time ago I stumbled upon SQLAlchemy which is a great ORM wrapper library for python. It has a nice syntax I'd like to see in a haskell library as well. SQLAlchemy already provides some lazy features such as loading subitems on access etc. All haskell SQL libraries I know only let you run SQL statements but not much more. To start real business you no longer want to write many SQL commands. Example why it matters: schools - 1:n - teachers - 1:n - pupils If you want to list all schools which have a pupil with age 3 you'd write an sql query like this: SELECT dictinct * FROM schools as s JOIN teachers t ON (t.school_id = s.id) JOIN pupils as p ON (p.teacher_id = t.id) WHERE p.age 3 in SQLAlchemy it looks like this: session.query(School).join(School.teachers).join(Teacher.pupils).filter(Pupil.age 3).all() difference? Because SQLAlchemy knows about the relations you don't have to remember alias names. So there is no chance to get that wrong. Another example: Updating the age of a pupil: row = SELECT * FROM pupils where age = 13; UPDATE pupils SET age = 14 WHERE id = the id you got above p = session.query(Pupil).filter(Pupil.age==13).one().age=14 session.commit() difference? You don't have to care about ids. you just assign a new value and tell the engine that it should commit. So again less chances to get something wrong. What about trees (eg web site navigation) id | title| parent_id 1 | top | null 2 | submenu | 1 3 | submenu2 | 1 should result in top - submenu - submenu2 using SQLAlchemy you can just do parent = session.query('nodes').filter(Node.id = 1) def print(node): print node.title print node.subnodes # this will run a subquery automatically for you returning submenu{,2} Again no sql. No chance to get something wrong? You can skim the manual to get a better idea how SQLAlchemy works http://www.sqlalchemy.org/docs/05/sqlalchemy_0_5_5.pdf I have to admit that I haven't used SQLAlchemy in a real project yet. However I can imagine doing so. Comparing this to what we have on hackage I'd say some work has to be done to get close to SQLAlchemy. The backend doesn't have to be a relational database. However I'd like to use this kind of abstraction in haskell. Is there anyone interested in helping building a library which a) let's you define kind of model of you data b) let's you store you model in any backend (maybe a relational database) c) does static checking of your queries at compilation time? Right now I'd say the best way to go is define the model in the application and not get the scheme from an existing database because there is not way to store all scheme details within a relational model. I think SQLAlchemy does it right by providing a way to define the model in python. Of course haskell doesn't have objects to store. But GADTs could be stored (data Foo = ...) So are there any volunteers who are interested in helping writing this kind of storage solution for haskell which could be used in real world business apps? Maybe this does already exist and I've missed it? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ORM for haskell?
Hi Mads! On Tue, Jun 30, 2009 at 11:49:40PM +0200, Mads Lindstrøm wrote: Hi Marc Weber Another example: Updating the age of a pupil: row = SELECT * FROM pupils where age = 13; UPDATE pupils SET age = 14 WHERE id = the id you got above p = session.query(Pupil).filter(Pupil.age==13).one().age=14 session.commit() difference? You don't have to care about ids. you just assign a new value and tell the engine that it should commit. So again less chances to get something wrong. Could you not do in SQL: UPDATE pupils SET age = 14 WHERE age = 13 Of course. But: you can pass around that pupil object to another function and still assign a new age then run session.commit(). When passing around the pupile you can follow the relation_ships (relations?) back to school. def doSomething(pupil): pupil['age'] = 13 pupil.teacher.school.rating += 1 doSomething(session.query(Pupil).filter(Pupil.age==13)) session.commit() Now how would you do this using SQL? Sorry about the confustion (relation / relation-ship). I mixed up the terminology. Anyway I guess you can see here how powerful an ORM can be and why we should write such a library for haskell. I think it's very hard to invent such a short synax in haskell cause you have to take monads into account etc.. And it matters how much time you have to spend writing code. Thanks for your feedback. I hope there will be some more. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Practise of hiding contsructors and serialization
While working on extending scion I got some trouble and wonder which is the best way to do this? I have to pass a compilation result from a scion process instance to the scion daemon process. Of course I'd just like to use a simple Read Show for that. However I can't because two datatypes are NominalDiffTime and Bag ErrMsg: newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord) data ErrMsg = ErrMsg { errMsgSpans :: [SrcSpan], errMsgContext :: PrintUnqualified, errMsgShortDoc :: Message, errMsgExtraInfo :: Message } Both are fine and both don't export all contstructors so you can't just let ghc derive instances for it? So the only way is to duplicate those datatypes in order to derive some Show, Read instances? On the one hand I do understand that you don't want users to access constructors directly. On the other hand it would be desirable to derive Read, Show instances here. Is there a way to get all? a) hiding constructors so that you don't have to expose implementation details to the user. b) still allow deriving serialization instances? Is there a better way than using toRational to get a type which can be serialzied quickly? I don't like Rational because the unit information 1e-12[s] is no longer included in the type.. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Practise of hiding contsructors and serialization
I usually use Data.Binary for serialization. Sure. But you can't derive Data.Binary easily for NominalDiffTime. That's the point. You can only do so by using toReal or by adding data MyOwnPico = MyOwnPico only to create serialization instances. I don't like this kind of code duplication.. Marc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hslogger bugs or features - patches
You didn't notice setHandlers? -- | Set the 'Logger'\'s list of handlers to the list supplied. -- All existing handlers are removed first. setHandlers :: LogHandler a = [a] - Logger - Logger It is perfectly valid to set the root logger's handlers to [] if you want it to do nothing at all. Which type to assign to [] ? Right now I'm using instance HL.LogHandler () where -- doh! find a better way to pass an empty list below setLevel = error should never be rearched getLevel = error should never be rearched emit = error should never be rearched close = error should never be rearched HL.updateGlobalLogger (HL.addHandler fh . HL.setHandlers ([] :: [()]) ) ... But I'm not satisfied with that. But I couldn't find a better solution either. Eg I've tried [] :: [SyslogHandler] (SyslogHandler is not exported, is it?) [] :: [GenericHandler ()] (GenericHandler isn't exported either?) Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] attempt creating alternative logging lib which is actually much slower (?)
without removing all all setLevel calls to subloggers? Is this desirable? I don't understand the problem. If you told hslogger that you didn't want to hear about stuff about A, why do you not like that it is following your instructions? Because taht don't want to hear abuot A could have been set without my knowledge. When trouble shooting a problem it could be handy to just get all messages. But when such a use case arrives I can still patch hslogger. mlog (attempt to create a minimal alternative) I've tried writing another minimal logging system. The idea was driven by adding the possibility to add a handler logging everything not matter what levels are set to different loggers or handlers. The design is simple: keep a list of log handlers and a list of filters. you can add a filter telling that a log message of A.B should not be logged. The actual handler function then looks like this log shouldbeLogged logmessage loggername prio = So you can still ignore shouldbeLogged easily. However I couldn't even come close to the speed of hslogger even when caching the list of handlers which are supposed to log the message. [some code snippets see end of mail] without any attached handlers: hslogger*[1] : 4ms mlog[2]: 12ms with one default stderr logger (./test 2 /dev/null) hslogger*[1] : 109ms mlog[2]: 150ms [1]: my modified version of hslogger (git://mawercer.de/hslogger) [2]: (git://mawercer.de/mlog) I've tried doing some investigation figuring out why my lib is that much slower but I failed. I noticed that -O2 had an impact on how often the list of generated test cases is run. But that has been all. I don't even use existential types! So I'll shut up and keep using hslogger. Thanks to you John Goerzen for your support. I've learned that I'm very bad at troubleshooting performance. I really thought I could make mlog faster than hslogger*. Using profiling (-P) didn't reveal the source wasting CPU cycles to me. Sincerly Marc Weber [ some code snippets of mlog] the global logger data looks like this: data GlobalLoggerData = GlobalLoggerData { handlers :: M.Map Int LogHandler -- assign a key so that this logger can be removed easily again ,filters :: M.Map Int GlobalFilter -- allow to add global filters -- cache information about which logger accepts what logging data -- String = Priority : loggername , cached :: M.Map String (Bool, [ LogMessageAction ]) } {-# NOINLINE globalLoggerData #-} globalLoggerData :: MVar GlobalLoggerData globalLoggerData = unsafePerformIO $ newMVar $ GlobalLoggerData M.empty M.empty M.empty -- add default handler: addHandler $ LogHandler { accept = \ln p - True -- which logging events does this log handler accept? ,logAction = \ln p msg doLog - hPutStrLn stderr msg ,close = return () } ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: hslogger bugs or features?
Hi John, thank you for your feedback: I've taken the time to rewrite the example (issue1) using the python logging system. I came up with: import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename='/tmp/myapp.log', filemode='w') logging.getLogger('').setLevel(logging.DEBUG) loggerSub = logging.getLogger('A.B.C') loggerSub.critical('CRITICAL test, should be shown and should create the sublogger') logging.getLogger('').setLevel(logging.WARNING) loggerSub.debug('WARNING test, should not be shown cause we have changed to WARNING') which only logs the first line but not the second one 2009-02-03 11:14:52,058 CRITICAL CRITICAL test, should be shown and should create the sublogger hackage hslogger does clone the priority setting for A.B.C (in getLogger). The cloned value is no longer affected by when changing the top level logging priority. So this example makes hackage hslogger log both lines. So I consider this a beeing a (small) bug. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Bytestrings vs String? parameters within package names?
On Mon, Feb 02, 2009 at 10:41:57PM -0500, wren ng thornton wrote: Marc Weber wrote: Should there be two versions? hslogger-bytestring and hslogger-string? I'd just stick with one (with a module for hiding the conversions, as desired). Duplicating the code introduces too much room for maintenance and compatibility issues. That's the big thing. The more people that use ByteStrings the less need there is to convert when combining libraries. That said, ByteStrings aren't a panacea; lists and laziness are very useful. Hi wren, In the second paragraph you agree that there will be less onversion when using only one type of strings. You're also right about encoding. About laziness you'r partially right: There is also Bytestring.Lazy which is a basically a list of (non lazy) Bytestring Duplicating the code introduces too much room for maintenance and compatibility issues. I didn't mean duplicating the whole library. I was thinking about a cabal flag the cabal file: flag bytestring Default: False Description: enable this to use Bytestrings everywhere instead of strings [... now libs and executables: ...] if flag(bytestring) cpp-options: -DUSE_BYTESTRING An example module module Example where #ifdef Strings import Data.List as S #endif #ifdef USE_BYTESTRINGS import Data.ByteString as S #endif #ifdef USE_LAZY_BYTESTRINGS import Data.ByteString.LAZY as S #endif #ifdef USE_UNICODE_BYTESTRING_LIKE_STRINGS -- two bytes per char or more? -- they can also be lazy such as Strings however one array element can -- have more than one byte import Data.Vector as S #endif Of course all four modules import Data.List as S import Data.ByteString as S import Data.ByteString.LAZY as S import Data.Vector as S must expose the same API.. Of course cluttering up all files using those ifdefs isn't a nice option either. But one could move this selection into the cabal file either depending on one of those (no yet existing) packages: string-string string-bytestring string-utf8-bytestring string-bytestring string-bytestring-lazy Then you could replace one implementation by the other and recompile and see wether the results differ. Of course we must take care that we can keep laziness if required. However using different packages exposing the same API (same modules and same name will cause trouble if you really have to use both implementations at some time. I only konw that there has been some discussion about how to tell ghc to use a module from a particual package. ..) So I'd like to propose another way: {-# LANGUAGE CPP #-} import Data.STRING as S and tell .cabal to define STRING representing either of the different string implementations. I think this would be most portable and you can additionally import other String modules as well. So for now I think it would be best if you could teach cabal to change names depending on flags: Name: hslogger-${STRING_TYPE} flag: use_strings set STRING_TYPE = String flag: use_bytestrings set STRING_TYPE = Bytestring . Don't think about this issue how it is now or how much effort it would be to rewrite everything. Think about it how you'd like to work using haskell in about a year. Marc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hslogger bugs or features - patches
Hi John, Yes, a NotSet corresponds to my new Nothing setting. Proably you're right that adding that would have been enogh. API changes: Probably you're talking about the introduction of those classes? The idea was to not have to split that String over and over again. This way I thought you could pass over the logger path (LoggerName [A,B,C]) directly.. Where do I find the benchmark? Look it up in tests/Benchmark.hs and the .cabal file. I've added the benchmark first before having done most updates so that it's easier to compare the results. About the Bytestring thing I won't bother you until I'm sure it's worth it. You're right: in a ready to go application you always keep the default logger. But I want to use hslogger also to verify that my application does what I think it should be doing .. And while learning about hslogger you will do things in different order. Maybe its just that the most important parts about hslogger didn't came through to my mind. Maybe one can shorten that all to this. At least that's how my change are supposed to work: The logging sytem is based on a tree. To each tree node you can attach handlers. When a loogging action is performed the tree is traversed from the logger name up to the root. The first node having attached an logging priority will be used to decide wether the message gets logged at all. If its logged all the handlers having been attached to the visited nodes will be called. Conclusions: having this setup: A.B.C log priority EMERGENCY log priority DEBUG the handlers atteched to won't get debug messages send to the A.B.C logger. So there is no way to trace all messages without knowing about all sub logger level settings. Something like this would have been enough give me an idea what the library really does. Anyway the least thing I need is the NOTSET logger level setting. Wether we call it Nothing or NOTSET doesn't matter. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: 1,000 packages, so let's build a few!
On Mon, Feb 02, 2009 at 10:07:57AM +, Neil Mitchell wrote: Hi The nix package manager (although beeing primarly a linux tool) can run on cygwin as well (at least it did some time ago).. I'd suggest trying that to package windows libraries. It dose generate tag files for you automatically as well. At least it can build dependencies such as C libraries and so on for you automatically as well. Unfortunately I don't have time to work on the windows port. The cool thing about nix is: You can always switch back to the previous generation if something breaks. It organizes the packages like a memory management system. You only reference the target and the deps in between will be build / removed automatically for you if they are no longer used when running the nix garbage collector. There is another drawback: It definitely only works on a ntfs partition. On the other hand it does also support binary distributions and install software by clicking on links. In the end this is perfect for developping (IMHO) even if you have to learn a lot at the beginning. My major problem hindering my starting to work on this is that cygwin doesn't run on Vista running in kvm/ qemu. sh.exe exits and that's it. So if you have a solution for that I'd consider resuming work on it Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Bytestrings vs String?
A lot of people are suggesting using Bytestrings for performance, strictness whatsoever reasons. However how well do they talk to other libraries? One I've in mind is hslogger right now. Should hslogger be implemented using Strings or Bytestrings ? Should there be two versions? hslogger-bytestring and hslogger-string? Or would it be better to implement one String class which can cope with everthing (performance will drop, won't it?) I feel it would make sense to talk about how to provide this? In the future I'd like to explore using haskell for web developement. So speed does matter. And I don't want my server to convert from Bytestrings to Strings and back multiple times.. So is the best we could do compile the same library twice using different flags ? One providing a Bytestring API, the other using Strings? Cluttering up code by from to Bytestring conversions doesn't look compelling to me. Thoughts? Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hslogger bugs or features - patches
== issue 1 That's not the most awkward thing: When logging to A.B.C hslogger does add 3 loggers to the global logger Map: A A.B A.B.C all three inheriting the default priority level of the default rootLogger A test application illustrating this (feature ?) module Main where -- packages: hslogger import System.Log.Logger as HL import System.Log.Handler.Simple as HL main = do -- the default logger logs to stderr level WARNING -- that's why the following message should be shown -- a) logM A.B.C HL.ALERT ALERT test, should be shown and should create the sublogger -- b) updateGlobalLogger rootLoggerName (setLevel EMERGENCY) logM A.B.C HL.ALERT ALERT test, should not be shown cause we have changed to EMERGENCY which prints: tmp %./test1 /tmp nixos ALERT test, should be shown and should create the sublogger ALERT test, should not be shown cause we have changed to EMERGENCY I've written some patches increasing speed by 30%. See the benchmark. You can get them by cloning git://mawercer.de/hslogger; (branch hslogger_updates) I've replaced the internal representation (Map name Logger) by a tree. Only logging to a logger does no longer add a new node (which cloned the priority level in the past causing issue 1) The basic interface updateLogger name (set priority or add handlers) and logM is still the same. The logM is based on MonadIO now. So you no longer have to call liftIO yourself.. Also I've removed the standard setup logging to stderr. There is a setupLogging function instead.. Why? I can think of some use cases where logging to stderr doesn't make sense and it took me too much time figuring out how to remve the old stderr logger (I didn't find a nice solution without changing the exposed API) I don't want to start using my personal copy of hslogger. That's why I'd like to ask you wether you consider these changes beeing improvements although they break existing code (You'll have do add that initialization line) I also wonder wether it's worth using Bytestrings instead of Strings? I've not spend to much time on updating all the documentation yet.. If you'd like to ensure that a use case sill works add another test case please. You can also push to that git repository. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] circular dependencies in cabal
Any suggestions? a) ignore it and hope you don't get segfaults or problems. b) choose one process libraries and rebuild the other packages using that one. About a) I'm not totally sure what could happen. I just can say That i've used different cabal versions and it went fine. I guess that the problem is A using P-1.0 B using P-1.2 you using A and B, passing data indirectly from A to B and A and B having different compilation options or different behaviour. I'm not too sure about this. Maybe this can give you an idea what could happen. On the other hand you do use runXY or system from process only without passing data from one to the other so chances are good that your app will work nevertheless. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] hslogger bugs or features?
Following the advice on the hslogger wiki (http://software.complete.org/software/wiki/hslogger) I'm posting my thoughts about hslogger here: What is wired? This piece of code (src/System/Log/Logger.hs): parentHandlers name = let pname = (head . drop 1 . reverse . componentsOfName) name in do [...] next - parentHandlers pname return ((handlers parent) ++ next) Why? Because when logging to A.B.C it splits the String once to get [A,B,C], then it drops the last part and runs the same again for A.B and so on.. So A string is split 3 times for one logging action. I think this is a waste of cpu cycles.. I'm going to improve this. While reading the code i noticed two issues: == issue 1 That's not the most awkward thing: When logging to A.B.C hslogger does add 3 loggers to the global logger Map: A A.B A.B.C all three inheriting the default priority level of the default rootLogger A test application illustrating this (feature ?) module Main where -- packages: hslogger import System.Log.Logger as HL import System.Log.Handler.Simple as HL main = do -- the default logger logs to stderr level WARNING -- that's why the following message should be shown -- a) logM A.B.C HL.ALERT ALERT test, should be shown and should create the sublogger -- b) updateGlobalLogger rootLoggerName (setLevel EMERGENCY) logM A.B.C HL.ALERT ALERT test, should not be shown cause we have changed to EMERGENCY which prints: tmp %./test1 /tmp nixos ALERT test, should be shown and should create the sublogger ALERT test, should not be shown cause we have changed to EMERGENCY which is quite confusing because I haven't told hslogger explicitely to use a log level printing ALERTs on A.B.C. so I'd expect that only the first message is shown. This behaviour is explained by the inheritance of the loglevel when hslogger creates them (without attaching handlers) automatically. I don't want the logging behaviour depend on wether a log line has been emitted before or not. Do you agree? Have I missed something? solution: replacing data Logger = Logger { level :: Priority, handlers :: [HandlerT], name :: String} type LogTree = Map.Map String Logger by a real log tree: data LogTree = LogTree { level :: Priority, -- level only applies to handlers, not to subLoggers handlers :: [HandlerT], subLoggers :: Map.Map String LogTree } == issue 2 The second ineresting point is (bug or feature?) that you can make the root logger shut up by setting different log levels to sub loggers: this sample does illustrate it: module Main where -- packages: hslogger import System.Log.Logger as HL import System.Log.Handler.Simple as HL main = do updateGlobalLogger (setLevel DEBUG) updateGlobalLogger A (setLevel EMERGENCY) logM A HL.ALERT ALERT test, should not be shown cause we have changed to EMERGENCY It doesn't print anything although the default log handler on root (=) is set to loglever DEBUG. So there is no way to get all logmessages without removing all all setLevel calls to subloggers? Is this desirable? == my conclusion: About issue 1 I think its a bug About issue 2 I don't know. I think there should be a way to get all log messages. So I feel this is a bug as well. I neither have checkeg the logcxx nor log4j nor the reference implementation in python. Thoughts? Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Web Framework
Hi Michael Snoyman, Donnie Jone, I don't think cross posting to web-devel and haskel-cafe is a good idea. Maybe do that but then advice people to either reply to cafe or to web-devel. So I suggest that we continue this discussion on web-devel. First of all there have been some attempts already to provide web frameworks for haskell. If you don't konw WASH yet please do have a look at the examples. I find the idea behind WASH pretty neat. It does also solve parts of the strict XHTML problem. you can only add valid tags and attributes. However it doesn't pay attention to order. (I don't think it was possible that time WASH was written). I've tried to make it better and verify that only valid XHTML is generated. The result is a finate state machine implented using functional dependencies. You can get the code from here git://mawercer.de/vxml.. However while doing so I noticed that this starts turning into a typing hell.. Why? There are some tags which require one or more childs (example : ul). So to distinguish both states (empty ul, ul with at least one element which may be closed) you need two different types. Thus you can no longer do myUl = ul $ map (li . show) [1...] My solution was to switch to a weak checking which only allows valid sub tags but does no longer care about order etc. So by now I'd vote for a partial validation only. a total validation isn't worth the effort. But it would be nice to to derive that from some specification (such as XHTML). So maybe have a look at my library and use the weak validation mode. About Ajax: I've developped some Ajax applications beeing written in PHP using MySQL.. In WASH everything is simple: You have one state (it doesn't know about AJAX). From that state you can go on, duplicate it etc. The state is passed to the client using an hidden input. So there is not that much you have to care about. But you can't write that much interaction easily either. When starting to write a web application (say a web shop).. it would be best if the client page keeps a state knowing about the basket and its content as well. And if you start implenting fancy features such as drag and drop I'm no longer sure which is the best way to handle this client state. I even don't know wether it can be abstracted on server side (using any language).. I'll watch you, keep posting to this list about your progress. Comments about the blog post (http://blog.snoyman.com/2009/01/25/haskell-web-framework/) Maybe the first step is writing down differences between existing haskell web frameworks. Probably the haskell wiki would be a good place to start. Another first step might be writing kind of abstraction so that an application can use either HAppS or apache or (fast)-CGI etc.. Encrypted cookies :-) Nice idea.. However this does mean a lot more traffic, doesn't it? It also depends on your storage enginge. If you have once keeping stuff in memory this won't hurt that much. But you're right. I'll think about that option About 13.: We should be able to simply specify the algorithm necessary to calculate an age from a birthday, and the framework will convert this into both client- and server-side code There is already a haskell - JS converter.. However this will cause a lot more traffic. And if you have many users only loading the front page .. How do you want to utilize the power of existing script frameworks (eg Mootools) ? Should the engine be aware about those? What about CSS abstraction ? I mean ie6 does read some CSS properties quite different.. What about JS automatic compression (maybe even rewriting names to shorter ones)? Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] some ideas for Haskell', from Python
1) In a Python string it is available the \U{name} escape, where name is a character name in the Unicode database. As an example: foo = uabc\N{VULGAR FRACTION ONE HALF} I think you can use quasi quotation of ghc to achieve this ? Your code would look like this then: let foo = [$mystr|abc\N{VULGAR FRACTION ONE HALF}] Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Computer time, independent of date
Is there an alternative? Something like how much time has passed since the program has started would be great. Have a look at benchpress on hackage. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Transactional container for storing anonymous deletable objects
Hi John Sorry, I don't think I really grasp your problem? I think you're mixing two things: a) which data type to use to store whatever you like? * http://haskell.org/haskellwiki/Existential_type * Typable and Data.Dynamic etc.. b) Which container to use to put in stuff, return an identifier so that it can be removed by id again? There are many ways. Probably something like Data.Map or finger trees will do very well.. (use Int as key type and use max + 1 when inserting a new one or such?) I hope I've helped you in some way.. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe