Re: [Haskell-cafe] (state) monad and CPS
Hello, Thank everybody for the answers. I must admit that I did not really emphasize the goal behind my initial question. Which is better expressed this way: 'walk' is written is CPS and is tail recursive. Unless I am wrong , if the continuation monad is used, the recursive calls to 'walk' are no longer in tail position. So my initial question was rather: is it possible to use the state monad and keeping the code tail recursive? I do not master all the subtilities of lazy evaluation yet and perhaps tail recursivity does not have the same importance (or does not offer the same guarantees) in a lazy language as it does in a strict language. But I am facing a similar problem with workflows in F# (F#'s monads). Thank you Regards J-C On Thu, Nov 12, 2009 at 8:17 AM, wren ng thornton w...@freegeek.org wrote: Nicolas Pouillard wrote: Excerpts from jean-christophe mincke's message of Tue Nov 10 21:18:34 +0100 2009: do acc - get put (acc+1) ... Since this pattern occurs often 'modify' is a combination of get and put: do modify (+1) ... Though the caveat about laziness applies here as well. modify is famously lazy which can lead to space leaks and stack overflows. Better would be to define and use your own strict version: modify' f = get = \x - put $! f x -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
On Wed, Nov 11, 2009 at 11:22 PM, David Virebayre dav.vire+hask...@gmail.com wrote: On Thu, Nov 12, 2009 at 7:18 AM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Evan, Thursday, November 12, 2009, 4:02:17 AM, you wrote: Recently the go language was announced at golang.org. There's not a lot in there to make a haskeller envious, except one real big one: compilation speed. The go compiler is wonderfully speedy. are you seen hugs, for example? i think that ghc is slow because it's written in haskell and compiled by itself If I understood, Evan is interested in ideas to speed up compilation. As far as I know, hugs is an interpreter, not a compiler. Well, the bottom line is a faster make a change, see it in action cycle. As I mentioned, ghci's bytecode compiler is pretty good as long as I don't have to recompile the unchanged modules, but I've never been able to get it to work once I have C libraries to link in, it doesn't take the same flags as the real linker (and it's OS X so there's that funky framework stuff) and no matter how many libraries I try to put in manually it has some missing symbol. I should give hugs a try, but I suspect it may have the same problem. I also seem to recall it can't save and reload the bytecode for unchanged modules, which is going to be slow no matter how fast the actual compilation is. Hugs is also going to have trouble linking in the ghc api... though to load code at runtime it might be faster and smaller to link in hugs rather than the ghc api. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] faster compiling for ghc
Hello David, Thursday, November 12, 2009, 10:22:41 AM, you wrote: are you seen hugs, for example? i think that ghc is slow because it's written in haskell and compiled by itself If I understood, Evan is interested in ideas to speed up compilation. As far as I know, hugs is an interpreter, not a compiler. it's impossible to interpret haskell - how can you do type inference? hugs, like ghci, is bytecode interpreter. the difference is their implementation languages - haskell vs C -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] The weirdest error I've ever seen...
Hiya Haskellers, So there I was, punching away at the keys, working on the Haskell Weekly News tools when the solution to one of my problems fell on me like a ton of lambdas. The solution and problem it solved are immaterial, but suffice to say it involved the combination of associated types and monad transformers, as well as some fancy deriving to end up with this code: # type Context = ReaderT Email type Match t = StateT t IO type ContextMatch t a = Context (Match t) a newtype FilterState t = Filter t a = Filter (ContextMatch t a) deriving (Functor, Monad, MonadReader Email, MonadState Bool, MonadIO) class FilterState t where data FState t deliver :: FState t - IO () # Again, the fine details are unimportant, but the punchline is `Filter` is a Monad which houses not only results, but also an internal state which will be used in the delivery of emails in some yet-to-be- determined way. Naturally, I want to use `deriving` to turn this puppy into a monad over it's second argument. In fact, the whole thing kind- checks alright, but presents me with this, the titular 'weirdest error I've ever seen...' # [1 of 3] Compiling Network.HackMail.Email.ParseEmail ( Network/ HackMail/Email/ParseEmail.hs, interpreted ) [2 of 3] Compiling Network.HackMail.Email.Email ( Network/HackMail/ Email/Email.hs, interpreted ) [3 of 3] Compiling Network.HackMail.Filter.Filter ( Network/HackMail/ Filter/Filter.hs, interpreted ) *** Exception: No match in record selector Var.tcTyVarDetails # Now, there are three tickets open on the GHC trac, found for me by the ever-helpful `copumpkin` on #haskell -- because I didn't think to look -- they are numbers 3621, 3422 and 2714. But none of them are sufficiently close to my case for them to make sense to me, nor are the solutions presented suitable for entry into my feeble noggin. (Thats just a purty way of saying I'm not smart enough to understand what any of it means...) So I beseech my fellow Haskellers[1], What the heck did I do to anger the Var.tcTyVarDetail gods? My guess (given what I can glean from the Trac entries) is that the `deriving ... MonadState ...` needs changing in some specific-yet- cryptic way, but I've only got my gut to go on... For the Record, and in the event it matters... [jfred...@erdos]$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.10.4 [jfred...@erdos]$ uname -a Linux Erdos 2.6.31-ARCH #1 SMP PREEMPT Fri Oct 23 11:12:58 CEST 2009 i686 Intel(R) Celeron(R) CPU 3.06GHz GenuineIntel GNU/Linux Thanks in advance for any help offered. /Joe [1] Bet you've never been beseeched before... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] The weirdest error I've ever seen...
| [1 of 3] Compiling Network.HackMail.Email.ParseEmail ( Network/ | HackMail/Email/ParseEmail.hs, interpreted ) | [2 of 3] Compiling Network.HackMail.Email.Email ( Network/HackMail/ | Email/Email.hs, interpreted ) | [3 of 3] Compiling Network.HackMail.Filter.Filter ( Network/HackMail/ | Filter/Filter.hs, interpreted ) | *** Exception: No match in record selector Var.tcTyVarDetails This is a bug in GHC without a doubt. It's possible that it's fixed in 6.12 -- can you try the release candidate? If it is not fixed, or if it's too hard for you to try, can you submit a Trac bug report please? (Include your code, and instructions for how to reproduce. Thanks Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem about hidden package again.
On Thu, Nov 12, 2009 at 7:32 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, Today, when I compiled gtk2hs, I got this: cairo/Graphics/Rendering/Cairo.hs.pp:264:0: Failed to load interface for `Data.Array.Base': it is a member of the hidden package `array-0.2.0.0' Use -v to see a list of the files searched for. As usual, I searched for the resolvement. No luck. And seems like this problem (not particularly to this package) is very common. I wonder how to resolve it? Is it compiled using Cabal? In that case you need to add array as a dependency. /m -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem about hidden package again.
No, it is not. I used configure/make way. Well I just noticed that there is a hide-all-package options to ghc. I do not know why. Maybe the author went crazy. On Thu, Nov 12, 2009 at 5:09 PM, Magnus Therning mag...@therning.org wrote: On Thu, Nov 12, 2009 at 7:32 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, Today, when I compiled gtk2hs, I got this: cairo/Graphics/Rendering/Cairo.hs.pp:264:0: Failed to load interface for `Data.Array.Base': it is a member of the hidden package `array-0.2.0.0' Use -v to see a list of the files searched for. As usual, I searched for the resolvement. No luck. And seems like this problem (not particularly to this package) is very common. I wonder how to resolve it? Is it compiled using Cabal? In that case you need to add array as a dependency. /m -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Static Linking Problem
On Thu, Nov 12, 2009 at 8:57 AM, David Virebayre dav.vire+hask...@gmail.com wrote: On Wed, Nov 11, 2009 at 5:44 PM, Svein Ove Aas svein@aas.no wrote: My recommendation would be to take glibc off the list of statically linked libraries. How do you do that ? By specifying the entire list manually, and not naming glibc. -- Svein Ove Aas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (state) monad and CPS
Excerpts from wren ng thornton's message of Thu Nov 12 08:17:41 +0100 2009: Nicolas Pouillard wrote: Excerpts from jean-christophe mincke's message of Tue Nov 10 21:18:34 +0100 2009: do acc - get put (acc+1) ... Since this pattern occurs often 'modify' is a combination of get and put: do modify (+1) ... Though the caveat about laziness applies here as well. modify is famously lazy which can lead to space leaks and stack overflows. Better would be to define and use your own strict version: modify' f = get = \x - put $! f x However if you want a strict state you should better use Control.Monad.State.Strict [1]. Finally I'm wondering if [1] is strict enough... [1]: http://www.haskell.org/ghc/docs/latest/html/libraries/mtl/Control-Monad-State-Strict.html -- Nicolas Pouillard http://nicolaspouillard.fr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem about hidden package again.
On Thu, Nov 12, 2009 at 9:11 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: No, it is not. I used configure/make way. Well I just noticed that there is a hide-all-package options to ghc. I do not know why. Maybe the author went crazy. Chances are the auther DIDN'T go crazy :-) It's a common practice to hide all packages, and then only bring the ones needed into visibility. I doubt that Gtk2hs is completely self contained, so somewhere in there is the directives that makes the needed packages visible again. Just add array and you should be past this particular hurdle. /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lambda-bot installation problem: gentoo trickery problem
Excerpts from Евгений Пермяков's message of Thu Nov 12 00:33:07 -0700 2009: When I try cabal-install lambdabot (gentoo linux/amd64, ghc installed with portage), it runs fine until compiler tries to link readline package (some template haskell?). The problem caused by dirty trick, used in gentoo: the /usr/lib64/libreadline is a fake with script, redirecting ld to /lib64 . GHC is not redirected but simply fails with message can't load .so/.DLL for: readline (/usr/lib64/libreadline.so: invalid ELF header). Yes, this is painful. There are discussions going on on ghc and on gentoo trackers for better ways to handle this. [1] [2] The problem is not gentoo specific though. Many other distros also use ld scripts, for example the same problem occurs using ubuntu. So, the question is: is there any workaround? Copying library look like an option, but it is very, very dirty one. Is there a way to say ghc, which libreadline.so it should load? To build lambdabot, and in other similar situations I have renamed the ld script temporarily and symlinked to the appropriate real .so then after the build put things back as they were. There are cases when this isn't sufficient, for example when the problem lib is needed for ongoing development project. Others more knowledgable can speak to how they've handled that. [1] http://hackage.haskell.org/trac/ghc/ticket/2615 [2] http://bugs.gentoo.org/290974 -- wmw ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fwd: (Solved) cabal install with external gcc tool chain not the ghc-bundled one
to answer this question myself how the use of another gcc is specified with effect, I used the following options with the 'cabal install' call: --ghc-options=-pgmc e:/programme/ghc/mingw-gcc4/bin/gcc.exe -pgml e:/programme/ghc/mingw-gcc4/bin/gcc.exe See http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#replacing-phases (searched in the wrong direction, too many trees...). Slightly tuned, this should be the way to go in all similar cases. One thing I haven't considered yet is if the '--with-ld' and '--with-gcc' options (if curious too, see logs in my previous mail - Subject [Haskell-cafe] caba install with external gcc toolchain not the ghc-bundled one) only effect what gets written into the setup-config/package.conf file or what other effects these have. Greets Daniel ---BeginMessage--- Hello friends, I have a question regarding one thing I can't get my head around: First my problem is, that wanted to install 'bindings-common' here on my Windows machine. Usually that is no problem with the help of the glorious cabal. Now, 'bindings-common' needs a higher version of gcc than the one bundled with ghc-6.10.4 to build as the developer told me, so I install the gcc version 4.4.0 by mingw and try to give the needed options to 'cabal install bindings-common...' - '--with-gcc=... --with-ld=...' etc. - At the same time I log everything cabal is putting to the outside world when doing the tasks for building the 'binding-commons': For this sake I use the '--build-log=...' option of 'cabal install' and at the same time pipe what gets shown on the terminal with 'tee' as well as verbosity level 3 for 'cabal install'. So far nothing new... But the package isn't built, so I wonder what the transcript is saying and have a look at the two generated log files, stating that the one generated by 'tee' tells me another linker (the one coming with the ghc-6.10.4 bundle) than I thought to have specified is actually used. An excerpt from the tee built log file: *** Linker: E:\programme\ghc\ghc-6.10.4\gcc -BE:\programme\ghc\ghc-6.10.4\gcc-lib/ ... Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc ... Thread model: win32 gcc version 3.4.5 (mingw-vista special r3) (Sorry if I'm mis-interpreting something here) While the log file resulting from the '--build-log' cabal install option has nothing suspicious in it telling me to (plan to?) use exactly what I specified by options. A little excerpt from that log file: (e:\\programme\\ghc\\ghc-6.10.4\\bin\\hsc2hs.exe,[--cc=e:/programme/ghc/mingw-gcc4/bin/gcc.exe,--ld=e:/programme/ghc/mingw-gcc4/bin/gcc.exe,--cflag=-Be:/programme/ghc/mingw-gcc4/lib/,--cflag=-Ie:/programme/ghc/mingw4-gcc/include,--cflag=-Le:/programme/ghc/mingw-gcc4/lib,--lflag=-Be:/programme/ghc/mingw-gcc4/lib/,--lflag=-Ie:/programme/ghc/mingw4-gcc/include,--lflag=-Le:/programme/ghc/mingw-gcc4/lib,--cflag=-D__GLASGOW_HASKELL__=610,--cflag=-Isrc,--cflag=-Ie:/programme/ghc/mingw-gcc4/include,--cflag=-D_ISOC99_SOURCE,--lflag=-Le:/programme/ghc/mingw-gcc4/lib,--cflag=-Ie:\\programme\\ghc\\ghc-6.10.4\\base-4.1.0.0\\include,--cflag=-Ie:\\programme\\ghc\\ghc-6.10.4/include,--lflag=-Le:\\programme\\ghc\\ghc-6.10.4\\base-3.0.3.1,--lflag=-Le:\\programme\\ghc\\ghc-6.10.4\\syb-0.1.0.1,--lflag=-Le:\\programme\\ghc\\ghc-6.10.4\\base-4.1.0.0,--lflag=-lwsock32,--lflag=-luser32,--lflag=-lshell32,--lflag=-Le:\\programme\\ghc\\ghc-6.10.4\\integer-0 .1.0.1,--lflag=-Le:\\programme\\ghc\\ghc-6.10.4\\ghc-prim-0.1.0.0,--lflag=-Le:\\programme\\ghc\\ghc-6.10.4,--lflag=-Le:\\programme\\ghc\\ghc-6.10.4/gcc-lib,--lflag=-lm,--lflag=-lffi,--lflag=-lgmp,--lflag=-lwsock32,-o,H:\\.homedir\\hugsdata\\build\\Bindings\\C\\Ctype.hs,src\\Bindings\\C\\Ctype.hsc]) ... Using ld given by user at: e:/programme/ghc/mingw-gcc4/bin/ld.exe So now my question is: Can anybody give me a good hint or tell me how I would, aside from using hard links or other file system related tasks, specify the external compiler, linker or gcc-toolchain to be used by 'cabal install' (or in consequence by 'ghc')? Cheers and thanks for your Daniel searching for ghc in path. found ghc at e:\programme\ghc\ghc-6.10.4\bin\ghc.exe (e:\\programme\\ghc\\ghc-6.10.4\\bin\\ghc.exe,[--numeric-version]) e:\programme\ghc\ghc-6.10.4\bin\ghc.exe is version 6.10.4 looking for package tool: ghc-pkg near compiler in e:\programme\ghc\ghc-6.10.4\bin found package tool in e:\programme\ghc\ghc-6.10.4\bin\ghc-pkg.exe (e:\\programme\\ghc\\ghc-6.10.4\\bin\\ghc-pkg.exe,[--version]) e:\programme\ghc\ghc-6.10.4\bin\ghc-pkg.exe is version 6.10.4 (e:\\programme\\ghc\\ghc-6.10.4\\bin\\ghc.exe,[--supported-languages]) Reading installed packages... (e:\\programme\\ghc\\ghc-6.10.4\\bin\\ghc-pkg.exe,[dump,--global]) (e:\\programme\\ghc\\ghc-6.10.4\\bin\\ghc-pkg.exe,[dump,--package-conf=h:\\.homedir\\ghc\\i386-mingw32-6.10.4\\package.conf]) Reading available packages... Resolving dependencies... selecting bindings-common-1.3.3 (hackage) and discarding
[Haskell-cafe] Re: Long running Haskell program
David Menendez wrote: I think replacing put s with put $! s should guarantee that the state is evaluated. If you're using get and put in many place in the code, you could try something along these lines: newtype SStateT s m a = S { unS :: StateT s m a } deriving (Monad, etc.) instance (Monad m) = MonadState s (SStateT s m) where get = S get put s = S (put $! s) Interestingly, this is different from Control.Monad.State.Strict . The latter never forces the state itself, just the pair constructor of the (result,state) pair. Here the different cases: evalLazy m = Control.Monad.State.Lazy.evalState m 0 evalStrict m = Control.Monad.State.Strict.evalState m 0 -- Pair constructor non-bottom GHCi evalLazy $ put undefined () GHCi evalStrict $ put undefined () -- Pair constructor bottom GHCi evalLazy $ put $! undefined *** Exception: Prelude.undefined GHCi evalStrict $ put $! undefined *** Exception: Prelude.undefined -- Last pair constructor non-bottom GHCi evalLazy $ (put $! undefined) put 1 () -- Everything bottom GHCi evalStrict $ (put $! undefined) put 1 *** Exception: Prelude.undefined Regards, apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Long running Haskell program
2009/11/12 Heinrich Apfelmus apfel...@quantentunnel.de Interestingly, this is different from Control.Monad.State.Strict . The latter never forces the state itself, just the pair constructor of the (result,state) pair. Yes. This bit me the first time I came across it. I think we need a Control. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fair diagonals (code golf)
On Wed, Nov 04, 2009 at 07:01:50PM +0100, Sjoerd Visscher wrote: To: Haskell Cafe haskell-cafe@haskell.org From: Sjoerd Visscher sjo...@w3future.com Date: Wed, 4 Nov 2009 19:01:50 +0100 Subject: Re: [Haskell-cafe] Fair diagonals (code golf) The code by Twan can be reduced to this: diagN = concat . foldr f [[[]]] f :: [a] - [[[a]]] - [[[a]]] f xs ys = foldr (g ys) [] xs g :: [[[a]]] - a - [[[a]]] - [[[a]]] g ys x xs = merge (map (map (x:)) ys) ([] : xs) merge :: [[a]] - [[a]] - [[a]] merge [] ys = ys merge xs [] = xs merge (x:xs) (y:ys) = (x++y) : merge xs ys But my feeling is that this can still be simplified further. Or at least refactored so it is clear what actually is going on! i wrote another solution: diag2 xs ys = join . takeWhile (not . null) . map f $ [1..] where f i = zip xs' ys' where xs' = take i $ drop (i - length ys') xs ys' = reverse $ take i ys diag [] = [] diag [q] = [q] diag qs = foldr f (map (:[]) $ last qs) (init qs) where f q' = map (uncurry (++)) . diag2 (map (:[]) q') diag is the recursion step over the dimensions; diag2 is the base case with two dimensions. i can see that it's less efficient on (partially) finite inputs, since i keep dropping increasing prefixes of xs and ys in the local f in diag2), and there are probably other issues. but it was fun staring at this problem for a while. :) matthias ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Long running Haskell program
2009/11/12 Heinrich Apfelmus apfel...@quantentunnel.de Interestingly, this is different from Control.Monad.State.Strict . The latter never forces the state itself, just the pair constructor of the (result,state) pair. Yes. This bit me the first time I came across it. I think we need a Control.Monad.State.StrictOnState with strict behaviour on the state value. I notice this same underlying issue is coming up in more than one thread on these lists. Matthew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: (state) monad and CPS
jean-christophe mincke wrote: I do not master all the subtilities of lazy evaluation yet and perhaps tail recursivity does not have the same importance (or does not offer the same guarantees) in a lazy language as it does in a strict language. Yep, that's the case. With lazy evaluation, tail recursion is less important. Also, code that looks tail recursive in a strict language will actually not be tail recursive in Haskell. A well-known example is the definition foldl and applied in the fashion of foldl (+) 0 [0..10] Regards, apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Resource compilation in GHC
Hello. I'm writing an wxHaskell application. Everything is ok, but now I need a separate folder for icons, bitmaps, and so on, from where they are loaded at runtime. How can I compile resources, and link them into my executable to provide for users single .exe file with resource section inside it? -- With best regards, Konstantin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
Dan Piponi wrote: To use these types with ghc you need to use the compilation flag -XExistentialQuantification. Or, more portably, add {-# LANGUAGE ExistentialQuantification #-} at the top of the source file. It should now compile in any computer that supports this feature without any special command-line flags. There's more to be found here: http://www.haskell.org/haskellwiki/Existential_typ Amusingly, half of this article is still the text that I wrote. ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
Joe Fredette wrote: Forall means the same thing as it means in math ...which not everybody already knows about. ;-) Even I am still not 100% sure how placing forall in different positions does different things. But usually it's not something I need to worry about. :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
2009/11/12 Andrew Coppin andrewcop...@btinternet.com: Joe Fredette wrote: Forall means the same thing as it means in math ...which not everybody already knows about. ;-) Even I am still not 100% sure how placing forall in different positions does different things. But usually it's not something I need to worry about. :-) To me it does not look like it does different things: everywhere it denotes universal polymorphism. What do you mean? I might be missing something. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Eugene Kirpichov Web IR developer, market.yandex.ru ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Long running Haskell program
On Thu, Nov 12, 2009 at 8:01 AM, Matthew Pocock matthew.poc...@ncl.ac.uk wrote: Yes. This bit me the first time I came across it. I think we need a Control.Monad.State.StrictOnState with strict behaviour on the state value. I notice this same underlying issue is coming up in more than one thread on these lists. This monad would indeed be useful, however it may be confusing as well. For example, if you are inserting elements in a Map using a lazy insert, seq'ing the map will only reduce it to WHNF (of course) and move the insertion down one level in the tree. IOW, I'd guess that OP's problem can't be solved just by seq'ing the map, he would have to use strict operations. There's a strict insertWith in Data.Map, but IIRC it's strict only on its combining operation, not on the insertion itself. Hmmm... maybe Control.Monad.State.RnfOnState? =P Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
Eugene Kirpichov wrote: 2009/11/12 Andrew Coppin andrewcop...@btinternet.com: Even I am still not 100% sure how placing forall in different positions does different things. But usually it's not something I need to worry about. :-) To me it does not look like it does different things: everywhere it denotes universal polymorphism. What do you mean? I might be missing something. I think what he means is that this: foo :: forall a b. (a - a) - b - b uses ScopedTypeVariables, and introduces the type-name a to be available in the where clause of myid. Whereas something like this: foo2 :: (forall a. a - a) - b - b uses Rank2Types (I think?) to describe a function parameter that works for all types a. So although the general concept is the same, they use different Haskell extensions, and one is a significant extension to the type system while the other (ScopedTypeVariables) is just some more descriptive convenience. Thanks, Neil. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
2009/11/12 Neil Brown nc...@kent.ac.uk: Eugene Kirpichov wrote: 2009/11/12 Andrew Coppin andrewcop...@btinternet.com: Even I am still not 100% sure how placing forall in different positions does different things. But usually it's not something I need to worry about. :-) To me it does not look like it does different things: everywhere it denotes universal polymorphism. What do you mean? I might be missing something. I think what he means is that this: foo :: forall a b. (a - a) - b - b uses ScopedTypeVariables, and introduces the type-name a to be available in the where clause of myid. Whereas something like this: foo2 :: (forall a. a - a) - b - b uses Rank2Types (I think?) to describe a function parameter that works for all types a. So although the general concept is the same, they use different Haskell extensions, and one is a significant extension to the type system while the other (ScopedTypeVariables) is just some more descriptive convenience. But that's not an issue of semantics of forall, just of which part of the rather broad and universal semantics is captured by which language extensions. Thanks, Neil. -- Eugene Kirpichov Web IR developer, market.yandex.ru ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Resource compilation in GHC
On Thu, Nov 12, 2009 at 11:12 AM, Konstantin Vladimirov konstantin.vladimi...@gmail.com wrote: Hello. I'm writing an wxHaskell application. Everything is ok, but now I need a separate folder for icons, bitmaps, and so on, from where they are loaded at runtime. How can I compile resources, and link them into my executable to provide for users single .exe file with resource section inside it? +1 ! I would also like to know how one can do it with gtk2hs. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
Hi, I'd really love a faster GHC! I spend hours every day waiting for GHC, so any improvements would be most welcome. I remember when developing Yhc on a really low powered computer, it had around 200 modules and loaded from scratch (with all the Prelude etc) in about 3 seconds on Hugs. ghc --make took about that long to start compiling the first file, and I think a complete compile was around 5 minutes. It's one of the main reasons I stuck with Hugs for so long. Running GHC in parallel with --make would be nice, but I find on Windows that the link time is the bottleneck for most projects. Thanks, Neil 2009/11/12 Bulat Ziganshin bulat.zigans...@gmail.com: Hello Evan, Thursday, November 12, 2009, 4:02:17 AM, you wrote: Recently the go language was announced at golang.org. There's not a lot in there to make a haskeller envious, except one real big one: compilation speed. The go compiler is wonderfully speedy. are you seen hugs, for example? i think that ghc is slow because it's written in haskell and compiled by itself hugs provides good interactive environment and good ghc compatibility, you can use conditional compilation to hide remaining differences. unfortunately, many haskell libs doesn't support hugs -- Best regards, Bulat mailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] faster compiling for ghc
Hello Neil, Thursday, November 12, 2009, 1:57:06 PM, you wrote: I'd really love a faster GHC! there are few obvious ideas: 1) use Binary package for .hi files 2) allow to save/load bytecode 3) allow to run program directly from .hi files w/o linking 4) save mix of all .hi files as program database using mysql or so second one may be useful for hugs too. also, once i have asked you for CPP support in winhigs ;) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Resource compilation in GHC
Hello Konstantin, Thursday, November 12, 2009, 1:12:35 PM, you wrote: I'm writing an wxHaskell application. Everything is ok, but now I need a separate folder for icons, bitmaps, and so on, from where they are loaded at runtime. How can I compile resources, and link them into my executable to provide for users single .exe file with resource section inside it? using win api, of course. look into SVN http://freearc.org:8080/freearc/trunk/ for example of how to add reources to executable (Unarc/makefile and compile.cmd). note that my program doesn't load anything from resources -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem about hidden package again.
Just joking. But still, since gtk2hs still using the configure/make way, it is complex to add another option to the system. I tried to add array to build-depends of Cairo.cabal, no luck. On Thu, Nov 12, 2009 at 5:28 PM, Magnus Therning mag...@therning.org wrote: On Thu, Nov 12, 2009 at 9:11 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: No, it is not. I used configure/make way. Well I just noticed that there is a hide-all-package options to ghc. I do not know why. Maybe the author went crazy. Chances are the auther DIDN'T go crazy :-) It's a common practice to hide all packages, and then only bring the ones needed into visibility. I doubt that Gtk2hs is completely self contained, so somewhere in there is the directives that makes the needed packages visible again. Just add array and you should be past this particular hurdle. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Long running Haskell program
How about: instance (Monad m) = MonadState s (SStateT s m) where get = S get put s = S (put $ using s $ strategy m) where our state monad has a strategy field? Matthew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
Bulat Ziganshin wrote: it's impossible to interpret haskell - how can you do type inference? hugs, like ghci, is bytecode interpreter. the difference is their implementation languages - haskell vs C We use Standard ML for the Isabelle/HOL theorem prover, and it's interpreted, even has an interactive toplevel. It uses type inference, does it not? In fact, in a not-very-serious discussion at some point of what one could replace javascript with for a browser-embedded language, SML came up. What makes Haskell so different that it can't be interpreted in the SML style? Sincerely, Rafal Kolanski. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
Regarding speeding up linking or compilation, IMO the real speedup you would get from incremental compilation linking. It's okay if the initial compilation linking take a long time, but the duration of next cl iterations should only depend on the number of changes one does, not on the total project size. On Thu, Nov 12, 2009 at 1:10 PM, Rafal Kolanski x...@xaph.net wrote: Bulat Ziganshin wrote: it's impossible to interpret haskell - how can you do type inference? hugs, like ghci, is bytecode interpreter. the difference is their implementation languages - haskell vs C We use Standard ML for the Isabelle/HOL theorem prover, and it's interpreted, even has an interactive toplevel. It uses type inference, does it not? In fact, in a not-very-serious discussion at some point of what one could replace javascript with for a browser-embedded language, SML came up. What makes Haskell so different that it can't be interpreted in the SML style? Sincerely, Rafal Kolanski. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] faster compiling for ghc
Hello Rafal, Thursday, November 12, 2009, 3:10:54 PM, you wrote: it's impossible to interpret haskell - how can you do type inference? hugs, like ghci, is bytecode interpreter. the difference is their implementation languages - haskell vs C We use Standard ML for the Isabelle/HOL theorem prover, and it's interpreted, even has an interactive toplevel. It uses type inference, does it not? In fact, in a not-very-serious discussion at some point of what one could replace javascript with for a browser-embedded language, SML came up. ghc also has interactive toplevel. it compiles haskell down to bytecode, though. type inference is a part of compilation process, afaik, ocaml also generates bytecode. don't know about isabelle -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] faster compiling for ghc
Hello Peter, Thursday, November 12, 2009, 3:26:21 PM, you wrote: incremental is just a word. what exactly we mean? ghc, like any other .obj-generating compiler, doesn't recompile unchanged source files (if their dependencies aren't changed too). otoh, (my old ghc 6.6) recompiles Main.hs if imported Sub.hs added new declaration (anyway unused in Main), so it may be improved some way Regarding speeding up linking or compilation, IMO the real speedup you would get from incremental compilation linking. It's okay if the initial compilation linking take a long time, but the duration of next cl iterations should only depend on the number of changes one does, not on the total project size. On Thu, Nov 12, 2009 at 1:10 PM, Rafal Kolanski x...@xaph.net wrote: Bulat Ziganshin wrote: it's impossible to interpret haskell - how can you do type inference? hugs, like ghci, is bytecode interpreter. the difference is their implementation languages - haskell vs C We use Standard ML for the Isabelle/HOL theorem prover, and it's interpreted, even has an interactive toplevel. It uses type inference, does it not? In fact, in a not-very-serious discussion at some point of what one could replace javascript with for a browser-embedded language, SML came up. What makes Haskell so different that it can't be interpreted in the SML style? Sincerely, Rafal Kolanski. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] faster compiling for ghc
On Thu, Nov 12, 2009 at 12:39 PM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Peter, Thursday, November 12, 2009, 3:26:21 PM, you wrote: incremental is just a word. what exactly we mean? Incremental linking means the general idea of reusing previous linking results, only patching it up with respect to changed obj files. So it's about reducing link times, not compile times. This has various consequences for executable size etc. so not something you'd want to do for release builds I think... Here's the documentation for VC's incremental linking option: http://msdn.microsoft.com/en-us/library/4khtbfyf(VS.80).aspx -- Sebastian Sylvan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Problem about hidden package again.
Magicloud Magiclouds magicloud.magiclo...@gmail.com writes: Just joking. But still, since gtk2hs still using the configure/make way, it is complex to add another option to the system. I tried to add array to build-depends of Cairo.cabal, no luck. Yes, it's not handy that gtk2hs can't use Cabal. But i think this is not easy when gtk2hs contain some many modules. -- Andy On Thu, Nov 12, 2009 at 5:28 PM, Magnus Therning mag...@therning.org wrote: On Thu, Nov 12, 2009 at 9:11 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: No, it is not. I used configure/make way. Well I just noticed that there is a hide-all-package options to ghc. I do not know why. Maybe the author went crazy. Chances are the auther DIDN'T go crazy :-) It's a common practice to hide all packages, and then only bring the ones needed into visibility. I doubt that Gtk2hs is completely self contained, so somewhere in there is the directives that makes the needed packages visible again. Just add array and you should be past this particular hurdle. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Long running Haskell program
Also, a *service* should have a persistence periodical action which should evaluate (most part of) the state thunks in their values to be serialized. This work for the structure similarity of NFData and Show/Binary classes. When there is a not directly serializable part of the state , things can get complicate, but resolving the persistence issue for those parts should resolve also the space leak, I think. paolino 2009/11/11 Paolino paolo.verone...@gmail.com Hello leimy, the only simple solution I have found to avoid a leaking state of a server is doing a periodical rnf of it, this implying the NFData constraint on its datatype. The reader should leak only if you nest forever the local function. paolino 2009/11/11 David Leimbach leim...@gmail.com As some of you may know, I've been writing commercial Haskell code for a little bit here (about a year and a half) and I've just recently had to write some code that was going to run have to run for a really long time before being restarted, possibly months or years if all other parts of the system cooperate as it's part of a server infrastructure management system. I recently ran into some serious space leak difficulties that would ultimately cause this program to crash some time after startup (my simulator is also written in Haskell, and runs a LOT faster than the real application ever could, this has enabled me to fast forward a bit the data growth issues and crash in minutes instead of days!) Anyway, rather than try to paste it all here with images and such I thought I'd stick it up on my blog so others could maybe benefit from the anecdote. It's difficult to disclose enough useful information as it is commercial code not under an open source license, but there's neat diagrams and stuff there so hopefully the colors are at least amusing :-) http://leimy9.blogspot.com/2009/11/long-running-haskell-applications.html Dave ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] flow2dot
I've installed the flow2dot utility. It fails to produce a dot file from the sample provided by it's author. The output of the program is: .cabal/bin/flow2dot sample.flow flow2dot: Input: order a b c d a - b: let's play catch a ball! b - c: i'll pass it along c: what to do next? c - a: lets throw it back again a: not fair! a - c: find someone else! c - d: ok, here you go: catch! d: zZzZzZzZzzz Error: sample.flow (line 1, column 1): unexpected o expecting -, : or end of input ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: socket error
Now my program does not produce the error. A thread that was involved in the process failed with the effect of blocking the main thread that processed the socket input and produced the output. That ended up in this strange error after waiting half a second (more or less). instead of being catched by the error handler. as I expected. 2009/11/4 Kui Ma mkl...@hotmail.com I am having the similar problem when running TCP server application on windows XP. The server can only reads once from the handle of socket, then any operation on the handle will cause error because it is already finalized. It seems a platform issues but I have no idea about it. -- Date: Tue, 3 Nov 2009 17:16:06 +0100 From: agocor...@gmail.com To: haskell-cafe@haskell.org Subject: [Haskell-cafe] Re: socket error I´m running windows, ghc 6.10.3 and 6.10.4 in two different machines. 2009/11/3 Alberto G. Corona agocor...@gmail.com socket: 1796: hPutBuf: illegal operation (handle is finalized) I´m a bit lost trying to find the source of this error. I´m running an hack application (package hack). Basically it is a handler of web requests. hack can be used with different web servers: Hyena, simpleserver, HappStack all of them produce this error after a few interactions., Supposedly, it happens within the socket module since neither my module, nor hack, nor the hack simpleserver (package hack-handler-simpleserver) call explicitly hPutBuf I tried to reproduce the error under linux, but my ubuntu installation is too old and I´m in the process of reinstalling everything again. In the meantime, Any of you can give me any hint about the error? -- Windows Live: Keep your friends up to date with what you do online.http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cabal upload issue
Hi all, I'm in the process of trying update the revisions of wx (part of wxHaskell) on hackage. I'm getting an error I find slightly surprising: 400 Error in upload The dependency 'build-depends: base' does not specify an upper bound on the version number. Each major release of the 'base' package changes the API in various ways and most packages will need some changes to compile with it. The recommended practise is to specify an upper bound on the version of the 'base' package. This ensures your package will continue to build when a new major version of the 'base' package is released. If you are not sure what upper bound to use then use the next major version. For example if you have tested your package with 'base' version 2 and 3 then use 'build-depends: base = 2 4'. In this case, we have the following in wx.cabal Library if flag(splitBase) build-depends: base = 3, wxcore = 0.12.1.1, stm else build-depends: base 3, wxcore = 0.12.1.1, stm Is this a bug, or am I doing something stupid? I should point out that this builds perfectly on my machine. Regards Jeremy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal upload issue
Jeremy O'Donoghue wrote: Hi all, I'm in the process of trying update the revisions of wx (part of wxHaskell) on hackage. I'm getting an error I find slightly surprising: ... Library if flag(splitBase) build-depends: base = 3, wxcore = 0.12.1.1, stm Change this last line to base = 3 5 to get rid of the warning. I think the idea is that if base becomes version 5, it will likely break your code, so you should specify ahead of time that this library isn't currently designed to work with a version of base beyond 4. That way when someone installs your package in the future and you haven't tested with base 5, cabal will know to use base 4 for your library. Thanks, Neil. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: (Solved) cabal install with external gcc tool chain not the ghc-bundled one
On Thu, 2009-11-12 at 10:46 +0100, Daniel Kahlenberg wrote: to answer this question myself how the use of another gcc is specified with effect, I used the following options with the 'cabal install' call: --ghc-options=-pgmc e:/programme/ghc/mingw-gcc4/bin/gcc.exe -pgml e:/programme/ghc/mingw-gcc4/bin/gcc.exe See http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#replacing-phases (searched in the wrong direction, too many trees...). Slightly tuned, this should be the way to go in all similar cases. One thing I haven't considered yet is if the '--with-ld' and '--with-gcc' options (if curious too, see logs in my previous mail - Subject [Haskell-cafe] caba install with external gcc toolchain not the ghc-bundled one) only effect what gets written into the setup-config/package.conf file or what other effects these have. Feel free to file a ticket about this. What makes me somewhat nervous is that the gcc you want to use for say .c files is not necessarily the same as the one ghc wants to use to compile .hc files or link stuff. This is particularly the case on Windows where ghc includes its own copy of gcc. Similarly on Solaris 10, ghc cannot use the /usr/bin/gcc because it's a hacked-up gcc that uses the Sun CC backend (which doesn't grok some of the crazy GNU C stuff that ghc uses). So it'd certainly be possible to have cabal's --with-gcc/ld override the ones that ghc uses by default, but the question is should it do so? I think it's worth asking the ghc hackers about this. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Cabal upload issue
Although it might be a pain in the arse to some degree, is there any reason why 'base' is considered special? As an example, I've come across a fair number of libraries/apps that (presumably) compile against a previous version of OpenGL, but not the current latest. Given it's impossible to test any package against libraries that don't yet exist, shouldn't the upper bound be required for all package dependencies? Just curious. :) ta, Sam -Original Message- From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Neil Brown Sent: 12 November 2009 14:36 To: Jeremy O'Donoghue Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Cabal upload issue Jeremy O'Donoghue wrote: Hi all, I'm in the process of trying update the revisions of wx (part of wxHaskell) on hackage. I'm getting an error I find slightly surprising: ... Library if flag(splitBase) build-depends: base = 3, wxcore = 0.12.1.1, stm Change this last line to base = 3 5 to get rid of the warning. I think the idea is that if base becomes version 5, it will likely break your code, so you should specify ahead of time that this library isn't currently designed to work with a version of base beyond 4. That way when someone installs your package in the future and you haven't tested with base 5, cabal will know to use base 4 for your library. Thanks, Neil. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cabal and autogenerated files
Hi all, Another, probably simple, question regarding cabalization. Part of wxcore, the low level abstraction in wxHaskell, consists of haskell modules which are generated automatically by parsing C headers using another tool, wxdirect. When trying to create an sdist package, we run into the problem that because we export modules which are automatically generated, after a 'clean', they do not exist, so the sdist package generation fails. We have tried using 'extra-tmp-files' to list the modules which are autogenerated, but this isn't working. Is this because we are generating the autogen modules in an autogen directory, or is this approach likely to fail wherever we put the autogenerated files? Our use case seems a reasonable one, as it could reasonably exist for any project which relies on automatically generated code. Thanks for any suggestions. Jeremy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The weirdest error I've ever seen...
Okay, so -- I feel totally awesome -- I never found a GHC bug before... and a Haskell Celebrity responded to my post! *swoons* :) Serious question now, There's a fair amount of definitely irrelevant code (like the definition of the `Email` type, etc), should I post that in the report too (assuming it doesn't work in 6.12 or I can't get 6.12 working to try it)? Thanks, /Joe On Nov 12, 2009, at 4:07 AM, Simon Peyton-Jones wrote: | [1 of 3] Compiling Network.HackMail.Email.ParseEmail ( Network/ | HackMail/Email/ParseEmail.hs, interpreted ) | [2 of 3] Compiling Network.HackMail.Email.Email ( Network/HackMail/ | Email/Email.hs, interpreted ) | [3 of 3] Compiling Network.HackMail.Filter.Filter ( Network/ HackMail/ | Filter/Filter.hs, interpreted ) | *** Exception: No match in record selector Var.tcTyVarDetails This is a bug in GHC without a doubt. It's possible that it's fixed in 6.12 -- can you try the release candidate? If it is not fixed, or if it's too hard for you to try, can you submit a Trac bug report please? (Include your code, and instructions for how to reproduce. Thanks Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The weirdest error I've ever seen...
Hi Joe, Serious question now, There's a fair amount of definitely irrelevant code (like the definition of the `Email` type, etc), should I post that in the report too (assuming it doesn't work in 6.12 or I can't get 6.12 working to try it)? http://hackage.haskell.org/trac/ghc/wiki/ReportABug - this is the reference. Do as many steps on this list as you want to, the more the easier it is for the GHC people, but they all take time: 1) Attach all the source code, enough to replicate the bug. 2) Download GHC 6.12 and check that it's still a bug there (if it's been fixed then it doesn't matter). 3) Start to boil down the test case by removing Email etc The important thing is to replicate the bug, but if you go further then it's less work for the GHC people. Don't try reducing the bug with GHC 6.10.4 though, because if it's a very subtle bug then you may stop it happening on other versions. Upon changing that, everything compiles fine and ghc hums along happily. Should I still submit a bug report for a bad error message? Yes, you crashed the compiler - that's a bug, even if it was caused by invalid source code. Thanks, Neil On Thu, Nov 12, 2009 at 6:12 PM, Joe Fredette jfred...@gmail.com wrote: Actually, I just solved the problem... I think... In my original code, I had the newtype: newtype FilterState t = Filter t a = Filter (ContextMatch t a) deriving (Functor, Monad, MonadReader Email, MonadState Bool, MonadIO) I was trying to confirm that it actually was the `deriving ... MonadState Bool ...` part that was causing the problem, and then I realized, it's not `MonadState Bool` I want, it's `MonadState t`. Upon changing that, everything compiles fine and ghc hums along happily. Should I still submit a bug report for a bad error message? /Joe On Nov 12, 2009, at 12:58 PM, Joe Fredette wrote: Okay, so -- I feel totally awesome -- I never found a GHC bug before... and a Haskell Celebrity responded to my post! *swoons* :) Serious question now, There's a fair amount of definitely irrelevant code (like the definition of the `Email` type, etc), should I post that in the report too (assuming it doesn't work in 6.12 or I can't get 6.12 working to try it)? Thanks, /Joe On Nov 12, 2009, at 4:07 AM, Simon Peyton-Jones wrote: | [1 of 3] Compiling Network.HackMail.Email.ParseEmail ( Network/ | HackMail/Email/ParseEmail.hs, interpreted ) | [2 of 3] Compiling Network.HackMail.Email.Email ( Network/HackMail/ | Email/Email.hs, interpreted ) | [3 of 3] Compiling Network.HackMail.Filter.Filter ( Network/HackMail/ | Filter/Filter.hs, interpreted ) | *** Exception: No match in record selector Var.tcTyVarDetails This is a bug in GHC without a doubt. It's possible that it's fixed in 6.12 -- can you try the release candidate? If it is not fixed, or if it's too hard for you to try, can you submit a Trac bug report please? (Include your code, and instructions for how to reproduce. Thanks Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal and autogenerated files
On Thu, 2009-11-12 at 17:54 +, Jeremy O'Donoghue wrote: Hi all, Another, probably simple, question regarding cabalization. Part of wxcore, the low level abstraction in wxHaskell, consists of haskell modules which are generated automatically by parsing C headers using another tool, wxdirect. When trying to create an sdist package, we run into the problem that because we export modules which are automatically generated, after a 'clean', they do not exist, so the sdist package generation fails. So I take it that these modules are generated from nothing rather than something like happy/alex pre-processors where the .hs files are generated from .y/.x files. Cabal supports the latter fairly well and you can add custom pre-processors in this style. It doesn't really support generating modules out of thin-air in the build step (though it does this internally for the Paths_pkgname module). We have tried using 'extra-tmp-files' to list the modules which are autogenerated, but this isn't working. extra-tmp-files means rm these files too when cleaning. It's mostly redundant since the better thing to do is to keep all temp build files in the build directory. Is this because we are generating the autogen modules in an autogen directory, or is this approach likely to fail wherever we put the autogenerated files? Our use case seems a reasonable one, as it could reasonably exist for any project which relies on automatically generated code. Tell me if I've misunderstood your problem. We'll have to think about how to get sdist to do the right thing for modules that have no ultimate corresponding source file. File a ticket with your description of your use case and what you'd like to be able to do. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The weirdest error I've ever seen...
Actually, I just solved the problem... I think... In my original code, I had the newtype: newtype FilterState t = Filter t a = Filter (ContextMatch t a) deriving (Functor, Monad, MonadReader Email, MonadState Bool, MonadIO) I was trying to confirm that it actually was the `deriving ... MonadState Bool ...` part that was causing the problem, and then I realized, it's not `MonadState Bool` I want, it's `MonadState t`. Upon changing that, everything compiles fine and ghc hums along happily. Should I still submit a bug report for a bad error message? /Joe On Nov 12, 2009, at 12:58 PM, Joe Fredette wrote: Okay, so -- I feel totally awesome -- I never found a GHC bug before... and a Haskell Celebrity responded to my post! *swoons* :) Serious question now, There's a fair amount of definitely irrelevant code (like the definition of the `Email` type, etc), should I post that in the report too (assuming it doesn't work in 6.12 or I can't get 6.12 working to try it)? Thanks, /Joe On Nov 12, 2009, at 4:07 AM, Simon Peyton-Jones wrote: | [1 of 3] Compiling Network.HackMail.Email.ParseEmail ( Network/ | HackMail/Email/ParseEmail.hs, interpreted ) | [2 of 3] Compiling Network.HackMail.Email.Email ( Network/HackMail/ | Email/Email.hs, interpreted ) | [3 of 3] Compiling Network.HackMail.Filter.Filter ( Network/ HackMail/ | Filter/Filter.hs, interpreted ) | *** Exception: No match in record selector Var.tcTyVarDetails This is a bug in GHC without a doubt. It's possible that it's fixed in 6.12 -- can you try the release candidate? If it is not fixed, or if it's too hard for you to try, can you submit a Trac bug report please? (Include your code, and instructions for how to reproduce. Thanks Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Cabal upload issue
On Thu, 2009-11-12 at 17:37 +, Sam Martin wrote: Although it might be a pain in the arse to some degree, is there any reason why 'base' is considered special? As an example, I've come across a fair number of libraries/apps that (presumably) compile against a previous version of OpenGL, but not the current latest. The plan eventually is to do this for all packages that opt-in to following the PVP[1]. Base follows the PVP and it's a bit special since it's the single package that causes most breakage when new major versions come out. So we're dealing with part of the problem now as a special case and the rest of the problem later when we've got the appropriate infrastructure. Given it's impossible to test any package against libraries that don't yet exist, shouldn't the upper bound be required for all package dependencies? True, however when you write that dependency you have no idea what that upper bound ought to be unless you know the package is following some kind of version policy. That's why we would only enforce it for packages that opt-in to the PVP. [1]: http://www.haskell.org/haskellwiki/Package_versioning_policy Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal and autogenerated files
I've had some luck with two techniques for this: 1. Create stub files, associated with a custom preprocessor which knows how to parse them and generate a Haskell module. For example, you might have Foo.wx-stub contain: [headers] wx/foo.h wx/otherheader.h and then parse it into parameters for wxdirect. That allows Cabal to generate the appropriate files automatically. Downside: I've not figured out how to get proper dependency resolution for this, so occasionally a clean and rebuild is required. 2. Use a Makefile to generate the files, placing them in a subdirectory added to Cabal's search path. This works well for pretty much anything, since Make is a bit more mature than Cabal's build system, but having to remember the pre-processing step is annoying. On Thu, Nov 12, 2009 at 09:54, Jeremy O'Donoghue jeremy.odonog...@gmail.com wrote: Hi all, Another, probably simple, question regarding cabalization. Part of wxcore, the low level abstraction in wxHaskell, consists of haskell modules which are generated automatically by parsing C headers using another tool, wxdirect. When trying to create an sdist package, we run into the problem that because we export modules which are automatically generated, after a 'clean', they do not exist, so the sdist package generation fails. We have tried using 'extra-tmp-files' to list the modules which are autogenerated, but this isn't working. Is this because we are generating the autogen modules in an autogen directory, or is this approach likely to fail wherever we put the autogenerated files? Our use case seems a reasonable one, as it could reasonably exist for any project which relies on automatically generated code. Thanks for any suggestions. Jeremy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] looking for a good algorithm
To: Casey Hawthorne cas...@istar.ca Subject: Re: [Haskell-cafe] looking for a good algorithm From: Casey Hawthorne cas...@istar.ca Date: Thu, 12 Nov 2009 11:14:02 -0800 On third thought, convert the table to a 2D array of bits (or a 1D array of bits mapped to a 2D coordinate system). The bit is true for either an Int or Double. If space is a concern and one can tolerate a low rate of false positives, than a 2D Bloom Filter might be appropriate, or a 1D Bloom Filter with mapping to 2D coordinates. http://en.wikipedia.org/wiki/Bloom_filter Then on to simmulated annealing, possibly. Note: Donald Knuth's new fascicle is out: Volume 4 Fascicle 1, Bitwise Tricks Techniques; Binary Decision Diagrams (2009), xiii+261pp. ISBN 0-321-58050-8 On Wed, 11 Nov 2009 15:32:35 -0800, you wrote: So, as I understand it, you have a very large sparse table, thousands of rows and hundreds of columns, of which each cell within a column of type String, Int, or Double can contain one of those types or nothing. Then you to want to shuffle the rows to maximize the number of columns whose first 100 rows have at least one number (Int or Double), given a list of preferred column names since there is no guarantee that every number column will have at least one number in its first 100 rows after shuffling. I'm wondering about hashing on the rows and hashing on the columns, then the column hash has the number of Int's or Double's (don't need the String's) in that column and the rows they are in. The row hash would have the number of Int's and Double's in that row and what column's they are in. Then; Then scan the row hash and sort into descending order, and by tagging those rows, not by actually moving them. Then I think your ready for simmulated annealing. -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
On Thu, Nov 12, 2009 at 2:50 AM, Eugene Kirpichov ekirpic...@gmail.com wrote: But that's not an issue of semantics of forall, just of which part of the rather broad and universal semantics is captured by which language extensions. The forall for existential type quantification is wierd. data Top = forall a. Any a -- existential data Bottom = All (forall a. a) -- rank 2 I think it makes much more sense in GADT syntax: data Top where Any :: forall a. a - Top data Bottom where All :: (forall a. a) - Bottom where it's clear the forall is scoping the type of the constructor. -- ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
Eugene Kirpichov wrote: 2009/11/12 Andrew Coppin andrewcop...@btinternet.com: Joe Fredette wrote: Forall means the same thing as it means in math ...which not everybody already knows about. ;-) Even I am still not 100% sure how placing forall in different positions does different things. But usually it's not something I need to worry about. :-) To me it does not look like it does different things: everywhere it denotes universal polymorphism. What do you mean? I might be missing something. I just meant it's not immediately clear how foo :: forall x. (x - x - y) is different from foo :: (forall x. x - x) - y It takes a bit of getting used to. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
2009/11/12 Ryan Ingram ryani.s...@gmail.com: On Thu, Nov 12, 2009 at 2:50 AM, Eugene Kirpichov ekirpic...@gmail.com wrote: But that's not an issue of semantics of forall, just of which part of the rather broad and universal semantics is captured by which language extensions. The forall for existential type quantification is wierd. data Top = forall a. Any a -- existential data Bottom = All (forall a. a) -- rank 2 Hm, you're right. I didn't even remember you could define existential types without GADT syntax. I also find the GADT syntax much better for teaching people what an ADT is. I think it makes much more sense in GADT syntax: data Top where Any :: forall a. a - Top data Bottom where All :: (forall a. a) - Bottom where it's clear the forall is scoping the type of the constructor. -- ryan -- Eugene Kirpichov Web IR developer, market.yandex.ru ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Linker?
Does anyone know here how GHC links in object files from other languages? I am getting a strange issue where it seems to be getting the calling convention on Fortran calls wrong. Specifically, on one computer (Gentoo Linux) I have with gcc and gfortran v4.4 and ghc compiled using gcc v4.3, I have no problems at all. On another computer (a Mac) I have with gcc 4.0 and gfortran 4.4 and a binary of ghc installed (as downloaded from haskell.org), I run into problems. Specifically, I noticed that the first parameter seems to get eaten when I declared a fortran routine as a function but not when I declare it as a subroutine. So I went ahead and converted the fortran routines into subroutines, but then I get another crash elsewhere in the code where a module calls a LAPACK routine for reasons unknown; I do not get this crash when running the same code path but called using a Python wrapper that uses gcc + gfortran + f2py rather than from my Haskell wrapper. I thought that this might be a problem with mixing gcc 4.0 and gfortran 4.4 (and ultimately I think this might still be the case), but when I tried writing small test cases using *only* gcc and gfortran and not ghc, everything worked just fine. Any thoughts? - Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Why can I run (runghc) some Haskell scripts but I cannot seem to compile them?
Why can I run (runghc) some Haskell scripts but I cannot seem to compile them? e.g. http://www.haskell.org/all_about_monads/examples/example25.hs I've changed the import listing to the following: import IO import System import Monad import Data.Maybe import Data.List import Data.Char (toLower) import Control.Monad.State import Control.Monad.Writer -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Why can I run (runghc) some Haskell scripts but I cannot seem to compile them?
Why can I run (runghc) some Haskell scripts but I cannot seem to compile them? e.g. http://www.haskell.org/all_about_monads/examples/example25.hs I've changed the import listing to the following: import IO import System import Monad import Data.Maybe import Data.List import Data.Char (toLower) import Control.Monad.State import Control.Monad.Writer The compiler errors are like the following: N-Queens.o:fake:(.text+0x2fe): undefined reference to `mtlzm1zi1zi0zi2_Controlzi MonadziStateziLazzy_zdf9_closure' N-Queens.o:fake:(.text+0x422): undefined reference to `mtlzm1zi1zi0zi2_Controlzi MonadziStateziLazzy_zdf7_closure' N-Queens.o:fake:(.text+0x66f6): undefined reference to `mtlzm1zi1zi0zi2_Controlz iMonadziWriterziLazzy_zdf1_closure' -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why can I run (runghc) some Haskell scripts but I cannot seem to compile them?
Did you try ghc --make? On Thu, Nov 12, 2009 at 3:12 PM, Casey Hawthorne cas...@istar.ca wrote: Why can I run (runghc) some Haskell scripts but I cannot seem to compile them? e.g. http://www.haskell.org/all_about_monads/examples/example25.hs I've changed the import listing to the following: import IO import System import Monad import Data.Maybe import Data.List import Data.Char (toLower) import Control.Monad.State import Control.Monad.Writer The compiler errors are like the following: N-Queens.o:fake:(.text+0x2fe): undefined reference to `mtlzm1zi1zi0zi2_Controlzi MonadziStateziLazzy_zdf9_closure' N-Queens.o:fake:(.text+0x422): undefined reference to `mtlzm1zi1zi0zi2_Controlzi MonadziStateziLazzy_zdf7_closure' N-Queens.o:fake:(.text+0x66f6): undefined reference to `mtlzm1zi1zi0zi2_Controlz iMonadziWriterziLazzy_zdf1_closure' -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Opinion about JHC
On Wed, 11 Nov 2009 00:37:59 -0800 John == John Meacham j...@repetae.net wrote: Hi John, John Yup. This was a major goal. compiling for iPhones and embedded John arches is just as easy assuming you have a gcc toolchain set up. John (at least with the hacked iPhone SDK.. I have never tried it with John the official one) Is there any info whether it works on maemo platform? Sincerely, Gour -- Gour | Hlapicina, Croatia | GPG key: F96FF5F6 signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Weird dependency failure log
Hi, all, Hackage shows a log failure for 'bindings-gsl': Configuring bindings-gsl-0.1.1... cabal-setup: At least the following dependencies are missing: bindings-DSL ==1.0.* But here is, at version 1.0.1, no building problems: http://hackage.haskell.org/package/bindings-DSL There's one thing special about bindings-DSL. It's a package with a set of macros for hsc2hs, and contains no Haskell code. Maybe this revealed some hidden error in package dependency checking. Thanks, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why can I run (runghc) some Haskell scripts but I cannot seem to compile them?
Shazam! Thank you! On Thu, 12 Nov 2009 15:13:47 -0500, you wrote: Did you try ghc --make? On Thu, Nov 12, 2009 at 3:12 PM, Casey Hawthorne cas...@istar.ca wrote: Why can I run (runghc) some Haskell scripts but I cannot seem to compile them? e.g. http://www.haskell.org/all_about_monads/examples/example25.hs I've changed the import listing to the following: import IO import System import Monad import Data.Maybe import Data.List import Data.Char (toLower) import Control.Monad.State import Control.Monad.Writer The compiler errors are like the following: N-Queens.o:fake:(.text+0x2fe): undefined reference to `mtlzm1zi1zi0zi2_Controlzi MonadziStateziLazzy_zdf9_closure' N-Queens.o:fake:(.text+0x422): undefined reference to `mtlzm1zi1zi0zi2_Controlzi MonadziStateziLazzy_zdf7_closure' N-Queens.o:fake:(.text+0x66f6): undefined reference to `mtlzm1zi1zi0zi2_Controlz iMonadziWriterziLazzy_zdf1_closure' -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
On Thu, Nov 12, 2009 at 8:52 PM, Andrew Coppin andrewcop...@btinternet.com wrote: I just meant it's not immediately clear how foo :: forall x. (x - x - y) is different from foo :: (forall x. x - x) - y It takes a bit of getting used to. That still confuses me. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
David Virebayre wrote: On Thu, Nov 12, 2009 at 8:52 PM, Andrew Coppin andrewcop...@btinternet.com wrote: I just meant it's not immediately clear how foo :: forall x. (x - x - y) is different from foo :: (forall x. x - x) - y It takes a bit of getting used to. That still confuses me. The difference is when the x variable gets bound - but to comprehend that, you have to realise that x gets bound at some point, which is non-obvious... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: hesql
Hello, sure, your program could use a database with HDBC. But I'll guess (since you love static typing so much) you dislike formulating queries in strings and to check the positions of your ?-placeholders and to convert your values with fromSql/toSql. Maybe you would prefer for your select query a list of tuples instead of a list of lists, because your beloved pattern matching needs always a dummy case. And here [1] is hesql... it's a preprocessor, which rewrites SQL-Queries as haskell functions. You put all your SQL-Queries (for example verifyLogin login' password' = select1' Accountid, Login, RealName, Email from Account where (password is null or password = md5(password')) and Lower(Login) = login' and not Locked; ) in a module (example/Account.hesql) and run $ hesql example/Account.hesql dbname=example which will write example/Account.hs, the real haskell module. It will generate code for a haskell function with the type: verifyLogin :: Stmts - String - String - IO (Maybe (Int, String, String, String)) (Ok, this is not quite correct. Check the README.) And Of course my SQL-Parser is very incomplete. Hesql works only with postgresql, etc, etc. So, please send me patches :-) Don't expect too much. Christoph Bauer [1] on hackageDB ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
Andrew Coppin wrote: I just meant it's not immediately clear how foo :: forall x. (x - x - y) is different from foo :: (forall x. x - x) - y Uhm, I guess you meant foo :: forall x. ((x - x) - y) VS. foo :: (forall x. x - x) - y , didn't you? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What does the `forall` mean ?
I just meant it's not immediately clear how foo :: forall x. (x - x - y) is different from foo :: (forall x. x - x) - y It takes a bit of getting used to. Those are different functions all together, so perhaps you meant these. foo :: forall x y. (x - x) - y bar :: forall y. (forall x . x - x) - y While neither function is seemingly useful, the second says that the higher-order argument must be polymorphic. I see two options: bar id bar undefined The first has these and many more: foo (+1) foo show foo ($) ... Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: flow2dot
Anakreon Mendis anakreon at csd.auth.gr writes: I've installed the flow2dot utility. It fails to produce a dot file from the sample provided by it's author. The output of the program is: [skip] Are you sure you are using version 0.7, since this is when order directive came into existence? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
On Nov 12, 2009, at 2:02 PM, Evan Laforge wrote: Recently the go language was announced at golang.org. It looks a lot like Limbo; does it have Limbo's dynamic loading? According to Rob Pike, the main reason for 6g's speed It's clear that 6g doesn't do as much optimisation as gccgo. It probably doesn't do as much optimisation as GHC. And it certainly doesn't have any kind of generics, let along type-level programming. I'd say the semantic distance between 'go' and x86 is quite a bit less than that between Haskell and x86. No laziness! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
On Thu, Nov 12, 2009 at 2:57 AM, Neil Mitchell ndmitch...@gmail.com wrote: Hi, I'd really love a faster GHC! I spend hours every day waiting for GHC, so any improvements would be most welcome. Has anyone built a profiling enabled GHC to get data on where GHC spends time during compilation? I remember when developing Yhc on a really low powered computer, it had around 200 modules and loaded from scratch (with all the Prelude etc) in about 3 seconds on Hugs. ghc --make took about that long to start compiling the first file, and I think a complete compile was around 5 minutes. It's one of the main reasons I stuck with Hugs for so long. Running GHC in parallel with --make would be nice, but I find on Windows that the link time is the bottleneck for most projects. Yes, when GHC calls GNU ld, it can be very costly. In my experience, on a linux virtual host I had to build my own GHC to disable split-obj because having it enabled caused ld to use about 1GB of memory. This is insane for a virtual host. I tried to solve it by adding swap that meant linking a trivial Setup.hs took about an hour. In conclusion, improving GNU ld could be a huge win for GHC, at least on linux. Does GHC on windows use GNU ld? Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
Running GHC in parallel with --make would be nice, but I find on Windows that the link time is the bottleneck for most projects. Yes, when GHC calls GNU ld, it can be very costly. In my experience, on a This is also my experience. GNU ld is old and slow. I believe its generality also hurts it, there is a much faster linker called gold, but it's ELF-only. The reference to incremental linking was interesting, but AFAIK gnu and apple ld don't support that. linux virtual host I had to build my own GHC to disable split-obj because having it enabled caused ld to use about 1GB of memory. This is insane for a virtual host. I tried to solve it by adding swap that meant linking a trivial Setup.hs took about an hour. Oh, this is interesting. I recently stumbled across split-obj, and I gathered it's a special ghc hack to reduce binary size by putting functions in their own obj files (I guess ld is not smart enough to only link used code?). If it slows down links, would it be worthwhile to disable split-obj for normal builds, and turn it on with -O2 for a production build? In conclusion, improving GNU ld could be a huge win for GHC, at least on linux. Does GHC on windows use GNU ld? Improving GNU ld would be a huge win in a lot of places, and the fact that no one has done it (excepting gold of course) goes to show it's a lot easier said than done! On Thu, Nov 12, 2009 at 4:58 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On Nov 12, 2009, at 2:02 PM, Evan Laforge wrote: Recently the go language was announced at golang.org. It looks a lot like Limbo; does it have Limbo's dynamic loading? Nope, I don't think it's that similar to limbo actually, though it does have channels. It reminds me of haskell in some places, for example no implicit conversions, RTS multiplexed lightweight threads, and interfaces which are vaguely similar to typeclasses. The channels are a subset of TChans, its select {} is like a non-nesting orElse restricted to reading from channels. According to Rob Pike, the main reason for 6g's speed It's clear that 6g doesn't do as much optimisation as gccgo. It probably doesn't do as much optimisation as GHC. And it certainly doesn't have any kind of generics, let along type-level programming. I'd say the semantic distance between 'go' and x86 is quite a bit less than that between Haskell and x86. No laziness! Indeed, the language is closer to the hardware and the type system is simpler. However, ghc can also be run without optimization. I think the main issue is that the designers had compilation speed as a feature from the beginning, and implemented some neat tricks to that end, which is why I mentioned how it pulls dependencies up to minimize file reading. Of course it could be that ghc already accomplishes the same end with --make by just keeping the interfaces in memory. Or file reading time is dwarfed by compiler cogitation. Of course a research language needs a flexible evolving compiler, maybe that's incompatible with a fast one. But fast builds are such a pleasure! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Pattern Matching
Why in a pattern match like score (1 3) = 7 can I not have sizeMax = 3 score (1 sizeMax) = 7 -- Regards, Casey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Pattern Matching
On Nov 12, 2009, at 21:15 , Casey Hawthorne wrote: Why in a pattern match like score (1 3) = 7 can I not have sizeMax = 3 score (1 sizeMax) = 7 Because it's a pattern, and when you introduce a symbol you are inviting the pattern match to bind what it matched to that name for use within the function. (Ordinary arguments are a trivial case of this.) Or, by example: score (1 sizeMax) = (expression using sizeMax) The normal way to do what you want is guards: score (1 x) | x == sizeMax = 7 -- you can pronounce the | as such that -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH PGP.sig Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Pattern Matching
Casey, Why in a pattern match like score (1 3) = 7 You probably mean score 1 3 = 7 which applies the function 'score' to two arguments. With the parentheses, it looks like an application of '1' to the argument '3'. But to answer your actual question... can I not have sizeMax = 3 score (1 sizeMax) = 7 When a variable name (such as 'sizeMax') appears in a pattern, it gets bound there. This is useful so you can refer to the variable on the right hand side, as in: successor x = x + 1 How would the compiler know whether to bind the variable (what actually happens), or match against the value represented by some earlier binding (what you're asking for)? What if the type of that second argument doesn't have a defined equality operation? There might be some reasonable way to do it, but I suspect it would be fragile and error-prone, at best. So it's always a new binding. It's easy enough to work around: score 1 x | x == sizeMax = 7 Regards, John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Opinion about JHC
This worked for me, though that was quite a while ago. Presumably it still works. I don't remember doing any magic, just using the Maemo cross-compiler to build the output of jhc. The only annoying part was having to build with jhc outside the scratchbox environment and then build the C output inside the scratchbox. This is necessary because jhc is not self-hosting and I couldn't get GHC to build for Maemo. The attempts to build GHC (back in the 6.8.2 days -- supposed cross-platform bootstrapping works again in 6.12, maybe it'll work now) and the success with JHC are documented at [1]. Actually, I just looked and Dustin Weese succeeded where I had failed, and got an unregisterized 6.8 to bootstrap to Maemo. I've since learned ARM(v4) assembly for an embedded systems course, I might look into writing a properly registerized ARM back-end for GHC 6.12, now that the back-end overhaul is complete. That's definitely a Copious Free Time project, since I don't intend to be doing any ARM dev in Haskell or otherwise. Braden Shepherdson shepheb [1] http://hackage.haskell.org/trac/ghc/wiki/ArmLinuxGhc Gour wrote: On Wed, 11 Nov 2009 00:37:59 -0800 John == John Meacham j...@repetae.net wrote: Hi John, John Yup. This was a major goal. compiling for iPhones and embedded John arches is just as easy assuming you have a gcc toolchain set up. John (at least with the hacked iPhone SDK.. I have never tried it with John the official one) Is there any info whether it works on maemo platform? Sincerely, Gour ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] C structures
Hello everyone. What about passing complex c-types (structures) to c-functions. More detailed: I have an application in production which was written in Delphi. IT has ability to create pluggable modules to it. Interface realized by sending Win32Api messages to application. function in haskell Win32 Graphics.Win32.sendMessage :: HWND - WyidowMessage- WPARAM - LPARAM - IO RESULT Application wants to get different data in WPARAM and LPARAM. Such as window descriptor (HWND), string pointers and datastructer pointers. The latter i don't know how to create. I need anyones experience. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: hesql
Christoph == Christoph Bauer i...@christoph-bauer.net writes: Christoph Hello, sure, your program could use a database with Christoph HDBC. But I'll guess (since you love static typing so Christoph much) you dislike formulating queries in strings and to Christoph check the positions of your ?-placeholders and to Christoph convert your values with fromSql/toSql. You guess right. That's why I use HaskellDB. Why would hesql be an improvement for me? It sounds like several steps backwards? -- Colin Adams Preston Lancashire ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
On 13/11/09 01:52, Evan Laforge wrote: Running GHC in parallel with --make would be nice, but I find on Windows that the link time is the bottleneck for most projects. Yes, when GHC calls GNU ld, it can be very costly. In my experience, on a This is also my experience. GNU ld is old and slow. I believe its generality also hurts it, there is a much faster linker called gold, but it's ELF-only. For someone like me, who only is interested in ELF on Linux, is there some way of getting GHC to use gold instead of ld? In conclusion, improving GNU ld could be a huge win for GHC, at least on linux. Does GHC on windows use GNU ld? Improving GNU ld would be a huge win in a lot of places, and the fact that no one has done it (excepting gold of course) goes to show it's a lot easier said than done! It could also mean that ld is good enough. Similar to how CVS was good enough for an awfully long time... ;-) /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] C structures
On 13/11/09 05:31, Vasiliy G. Stavenko wrote: Hello everyone. What about passing complex c-types (structures) to c-functions. More detailed: I have an application in production which was written in Delphi. IT has ability to create pluggable modules to it. Interface realized by sending Win32Api messages to application. function in haskell Win32 Graphics.Win32.sendMessage :: HWND - WyidowMessage- WPARAM - LPARAM - IO RESULT Application wants to get different data in WPARAM and LPARAM. Such as window descriptor (HWND), string pointers and datastructer pointers. The latter i don't know how to create. I need anyones experience. Possibly this old post of mine can help: http://therning.org/magnus/archives/315 /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Opinion about JHC
On Thu, 12 Nov 2009 22:44:22 -0500 Braden == Braden Shepherdson braden.shepherd...@gmail.com wrote: Braden This worked for me, though that was quite a while ago. Braden Presumably it still works. I don't remember doing any magic, Braden just using the Maemo cross-compiler to build the output of jhc. Thank you for the info. Braden I've since learned ARM(v4) assembly for an embedded systems Braden course, I might look into writing a properly registerized ARM Braden back-end for GHC 6.12, now that the back-end overhaul is Braden complete. It's no rush here, so having it in 6.12 would be cool. Braden That's definitely a Copious Free Time project, since Braden I don't intend to be doing any ARM dev in Haskell or otherwise. Well, I'm thinking about having 'light' version of desktop app running on something like N900, but it would involve gtk2hs as well, but that's another part of the story... Sincerely, Gour -- Gour | Hlapicina, Croatia | GPG key: F96FF5F6 signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] faster compiling for ghc
Jason Dagit da...@codersbase.com writes: Running GHC in parallel with --make would be nice, but I find on Windows that the link time is the bottleneck for most projects. Yes, when GHC calls GNU ld, it can be very costly. In my experience, I'll add mine: On my Ubuntu systems, linking is nearly instantaneous. On RedHat systems, it takes a noticeable amount of time - perhaps five to ten seconds. I'm not sure what the difference is caused by, I can try to investigate if it is of interest. -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe