what is the path to a particular module?
Is there a way from GHCi to discover the path to a particular module that you have imported or loaded? -Alex- ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: [Haskell-cafe] Packages and modules
Simon, We covered this extensively in the Cabal vs Haskell thread starting here: http://www.haskell.org//pipermail/libraries/2005-April/003607.html You concluded it by saying on April 22: And this observation points towards a simpler solution: rather than invisibly pre-pend the package name, just get the programmer to do so. So package P exposes a module called P.M and package Q exposes Q.M. All P's internal modules are called P.something, and similarly for Q. (We rely on some social mechanism for allocating new package names, as now.) Now of course you can import P.M and Q.M in a single module. That would be simple. It might be pretty inconvenient to say 'import Base.Data.List' rather than just 'import Data.List'. But nothing forces you to do this -- and indeed we don't do it for the current 'base' package. The point is that it's an easy way for a package author to ensure their package won't conflict with others. If they choose not to avail themselves of it, it's more likely that their package will be unusable because of accidental name conflicts. Bottom line: the current story is pretty defensible. I'm not sure that keeping names unique by implicitly using package-ids is worth the bother. http://www.haskell.org//pipermail/libraries/2005-April/003672.html It seems like you are changing your position with this proposal? Any reason for doing so? -Alex- __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com On Mon, 26 Jun 2006, Simon Peyton-Jones wrote: Simon and I have been thinking about fixing this, and we think we might actually do so for GHC 6.6. Your message provoked us to write up the design. It's here http://hackage.haskell.org/trac/ghc/wiki/GhcPackages Feedback welcome It's worth reading the old threads; for example http://www.haskell.org//pipermail/libraries/2005-August/004281.html But there are many others! Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian | Hulley | Sent: 25 June 2006 10:16 | To: Haskell-cafe | Subject: [Haskell-cafe] Packages and modules | | Hi - | At the moment there is a problem in that two packages P and Q could contain | the same hierarchical module eg Data.Foo, and the only way for user code to | ensure the right Data.Foo is used is to ensure that packages P and Q are | searched in the right order. | However suppose P and Q also contain another module with the same name, eg | Data.Bar. | And suppose a user module wants to use Data.Foo from P but Data.Bar from | Q!!! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: [glasgow-haskell-users] Searchpath vs. Cabalfind (was: installing a Cabal package non-exposed)
Oops. I just fixed the docs. The URL I am using is http://searchpath.org/default.map I intend to get an SSL cert for this but have not done so yet. -Alex- On Fri, 16 Jun 2006, Dimitry Golubovsky wrote: Alex, S. Alexander Jacobson wrote: Searchpath allows you easily to give each application its own namespace and automates import chasing accross the internet. It is a work in progress and is definitely less refined than cabal, but if you are having this sort of issue you might want to try it out. See http://searchpath.org Looks very interesting. However I couldn't get anything like https://hackage.org/modules.map; in a browser (nor with http: nor from www.hackage.org): it says unknown host. I am just curious: instead of querying a centralized database, have you tried any way to get modules' locations from search engines? I wish I could see what modules.map looks like, then I could see better whether what Cabalfind gets from Google could be an alternative? Not that I am pushing for Cabalfind in any way; just curious. -- Dimitry Golubovsky Anywhere on the Web __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: 6.4.1 Bug? getServiceEntry: does not exist (no such service entry)
Is there a 6.4.2 binary for winXP? I assuming doing a build from source is non-trivial. -Alex- On Thu, 23 Mar 2006, Simon Marlow wrote: S. Alexander Jacobson wrote: I just upgraded to 6.4.1 from 6.4.0 and am now getting this error when I run socket code via ghci, but not when I compile the code using ghc. Any idea what this is or how to fix? getServiceEntry: does not exist (no such service entry) This was reported a while back, and I still have it on my queue to investigate: http://www.haskell.org//pipermail/haskell-cafe/2005-October/011777.html However, I just checked and it doesn't happen with a recent 6.4.2 snapshot, so I'm going to consider it fixed (probably another weird mingw version interaction, or something). Grab a 6.4.2 snapshot and you should be happy. Cheers, Simon __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: 6.4.1 Bug? getServiceEntry: does not exist (no such service entry)
Snapshot downloads but locks up on a program that works fine w/ 6.4. -Alex- On Thu, 23 Mar 2006, Simon Marlow wrote: Binary snapshots allordy here: http://www.haskell.org/ghc/dist/stable/dist/ Cheers, Simon On 23 March 2006 16:54, S. Alexander Jacobson wrote: Is there a 6.4.2 binary for winXP? I assuming doing a build from source is non-trivial. -Alex- On Thu, 23 Mar 2006, Simon Marlow wrote: S. Alexander Jacobson wrote: I just upgraded to 6.4.1 from 6.4.0 and am now getting this error when I run socket code via ghci, but not when I compile the code using ghc. Any idea what this is or how to fix? getServiceEntry: does not exist (no such service entry) This was reported a while back, and I still have it on my queue to investigate: http://www.haskell.org//pipermail/haskell-cafe/2005-October/011777.html However, I just checked and it doesn't happen with a recent 6.4.2 snapshot, so I'm going to consider it fixed (probably another weird mingw version interaction, or something). Grab a 6.4.2 snapshot and you should be happy. Cheers, Simon __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ** CRM114 Whitelisted by: [EMAIL PROTECTED] ** __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: 6.4.1 Bug? getServiceEntry: does not exist (no such service entry)
On Thu, 23 Mar 2006, Duncan Coutts wrote: On Thu, 2006-03-23 at 13:22 -0500, S. Alexander Jacobson wrote: Snapshot downloads but locks up on a program that works fine w/ 6.4. I'm afraid we'll need a little more information than that if you intend this as a bug report. Ok, I guess the easiest way to reproduce is: 0. curl http://searchpath.org/searchpath/SearchPath.hs SearchPath.hs 1. ghc --make -main-is SearchPath SearchPath.hs -o sp 2. darcs get http://pass.net/s/repo pass.net 3. cd pass.net 4. ..\sp ghci -DINTERACTIVE -isrc --internet http://searchpath.org/default.map src/Main.hs 5. main 6. open firefox or IE to http://localhost:8000 Searchpath will take care of downloading all the required libraries into the .haskell_cache directory. Normally hitting 'e' at this point should exit main and return you to the ghci shell, but that doesn't appear to be working in 6.4.2 either or responds so slowly as to effectiveyl be the same. Note: What appears to be happenning is that the whole thing is just sloo under 6.4.2. It appears to be doing the right thing, but at such a slow pace as to be unusable. -Alex- __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
6.4.1 Bug? getServiceEntry: does not exist (no such service entry)
I just upgraded to 6.4.1 from 6.4.0 and am now getting this error when I run socket code via ghci, but not when I compile the code using ghc. Any idea what this is or how to fix? getServiceEntry: does not exist (no such service entry) FYI, I am running WinXP SP2. -Alex- __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
ghc on on macbook pro (fwd)
Does ghc work on the (intel) macbooks or does it need to be rebuilt? Will code compiled for the old macs work on the macbooks or does it need to be recompiled? -Alex- __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Set, Map libraries
Any reason the libaries don't define: class HasNull a where null::a-Bool class HasEmpty a where empty::a I find that I sometimes switch between using lists, sets, or tables as my collection type and the forced import qualifification for generic collection operations seems annoying. -Alex- On Thu, 2 Jun 2005, Robert van Herk wrote: 6. My module applies Data.Set.null (s :: Set a), and null (xs :: [a]). Why ghc reports of the clash with GHC.List.null ? Is GHC.List same as old List library module? Should I write import GHC.List (genericLength, null) instead of import List (genericLength) ? As the documentation reads: This module is intended to be imported qualified, to avoid name clashes with Prelude http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html functions. eg. import Data.Set as Set So, you should write: import qualified Data./x/ as /y/ Now, no name clashes will occur. However, you will have to write /y/.null to access null in /x/, for example: import qualified Data.Set as Set if (Set.null ...) then ... else ... Regards, Robert ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
ANN: SearchPath 0.5 and Request for https module URLs
At Simon Marlow's suggestion, I have implemented Internet import chasing. You wrap your compiler/interpreter call with searchpath, pass the correct parameters and it will find all your module imports, if they are not local, it will look them up in Internet module directories you specify, retrieve the relevant modules, put them on your path and then run your compiler/interpeter with the appropriate commandline options. e.g. searchpath ghc MyModule.hs OtherModule -isomeDir --internet localModules.map -iotherdir --internet https://hackage.org/modules.map -iotherDir2 -cache cache will result in the download of all the modules it can find each directory and execute: ghc MyModule.hs OtherModule -isomeDir --icache/internet1 -iotherdir -icache/internet2 -iotherDir2 Mapfiles have the form: #comment HAppS http://happs.org #comment *.*.HaXml.* http://www.cs.york.ac.uk/fp/darcs/HaXml/src #another comment Simon, I am now handling import chasing, Haskell extensions, literate haskell, latex haskell, and HTTPS URLs (via curl). It works with the ghc command line, except that it doesn't handle multiple directories passed on the same -i. (Can someone tell me what the official path separator is for ghc -i?). It doesn't yet work with other compilers/interpreters, but should be easy to adapt. It does not handle package files right now. Request: This will work better as people expose their modules via http(s). If your modules are visible this way, please email me a baseURL. Location: http://happs.org/SearchPath.hs -Alex- __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Emitting java bytecode?
A lot of phones run java bytecode. It would be nice (and rather cool) to be able to write midlets in Haskell in addition to Java (And there would be some irony in being able to do this in Haskell but not in Erlang on Ericson phones!) -Alex- __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com On Wed, 22 Dec 2004 [EMAIL PROTECTED] wrote: Einar Karttunen writes: Tomasz Zielonka [EMAIL PROTECTED] writes: For example, some darcs users complain ... Perhaps making -keep-hc-files a bit more documented ... This could be faster and easier to implement than creating a version of the RTS running under the JVM. == More generally: do you (Tomasz and others) really think that Java, or even C/C++ is a good portable platform for implementing efficiently Haskell or other lazy functional languages?? I believe this has been discussed already. And GHC passed already through this stage. I don't believe the world can return to it. The RT model is different, even decently implemented tail recursion is not so easy in C, and in Java I wouldn't bet either. Moreover, I don't think that Haskell is a good way to perpetuate imperative languages as portable platforms. While Lisp machine belongs to the past, it seems reasonable to hope that functional hardware, with some universal implementation paradigms, will be more popular... Jerzy Karczmarczuk ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Dynamic Source Loading
I am writing a web application server in Haskell. I would like to be able to modify the app on the fly. Simplyfing the app server, it would look like this: appServer appMVar reqChan state = do req - readChan reqChan app - readMVar appMVar (state',resp) - return $ app state req forkIO $ doResp req resp appServer appMVar reqChan state' The app would get loaded as follows: updateApp writeLog appMVar moduleName fnName = do mbApp - (getApp = Just) `catch` (\err - writeLog err return Nothing) maybe (return ()) (overWriteMVar appMVar) mbApp threadDelay 1000 updateApp appMVar moduleName fnName where getApp = ghci_load_module moduleName = flip ghci_getName fnName overWriteMVar mvar val = if isEmptyMVar appMVar then putMVar appMVar app else swapMVar appMVar app {-- Is there a way to overwrite an MVar without risking blocking by another thread filling it before the putMVar? Note it would be really nice if: * ghci_load_module would use an already cached module if the underlying source file has not changed (and therefore cost little performance-wise). * the returned code would be compiled with lots of optimization, etc. * Bonus: it would verify that the loaded function is type consistent with channel but tolerate bigger data types so that if the prior app assumed state was data State = Foo | Bar It would not be an error if the new app handled a state that looked like: data State = Foo | Bar | Baz The result would be a haskell server where all the haskell source acts like asp, jsp, php pages, but its all type safe and you don't have to define a standard page type as in HSP. I am aware that there is a DynamicLoader project: http://www.dtek.chalmers.se/~d00ram/dynamic/ That lets you load object files. But I would really like something that loads source files instead Is this possible? -Alex- __ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
How do I specify the source search path?
I have the working code for my Haskell App Server Framework in ~/HAppS/HAppS.hs. If I want to start working on an app that uses this framework in e.g. ~/MyApp, how do I tell GHCi to resolve import HAppS? Note: The HAppS code is in active development so I don't want to put it in the system GHC lib hierarchy. I just want to use it add hoc from the command line. -Alex- _ S. Alexander Jacobson mailto:[EMAIL PROTECTED] tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: sizeFM type
Sun and Dell both sell 64-bit boxes. But the core question is why have two different types at all? This issue is timely because I just got an error in code that looks vaguely like: h-openFile foo AppendMode pos - hFileSize h hPutStr $ show something hClose h content - readFile foo return $ take pos content This code produces an error because (madness!): hFileSize::Handle - IO Integer take::forall a. Int - [a]-[a] I have to assume conversion between files and lists is not all that rare even in beginner code. Note: I don't really care whether everything is 64bit Int or Integer. I just find having to care about this point in such trivial code ridiculous. And re sizeFM, I would note that Google has more than 2^31 pages indexed in memory. -Alex- _ S. Alexander Jacobson mailto:[EMAIL PROTECTED] tel:917-770-6565 http://alexjacobson.com On Sun, 25 Apr 2004, David Roundy wrote: On Sun, Apr 25, 2004 at 03:20:42PM -0400, S. Alexander Jacobson wrote: QUESTION: I read in a newspaper that in l981 you said '640K of memory should be enough for anybody.' What did you mean when you said this? ANSWER: I've said some stupid things and some wrong things, but not that. No one involved in computers would ever say that a certain amount of memory is enough for all time. http://www.wired.com/news/print/0,1294,1484,00.html Dell's Poweredge servers address up to 32GB of memory today! There are already 5.7 billion people on the planet (2^31) and 741 million phone lines. In my mind, there is NO QUESTION that 2^31 keys is a reasonable size for a FiniteMap or will be in the very very near future. On the other hand, since they are still 32 bit computers, any given application can still only access 4G of memory. This issue will only be a problem on 64 bit platforms which have a 32 bit Int. Moreover, it is not clear that the CPU/memory overhead of returning Integer rather than Int for sizeFM is sufficiently high to be worth bothering the programmer about. I'd say that rather than returning an Integer, we'd be better off just using a 64 bit Int on 64 platforms. -- David Roundy http://www.abridgegame.org ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: sizeFM type
On Mon, 26 Apr 2004, Simon Marlow wrote: Probably if the take function were being designed today, there would be no question about whether it should take Int or Integer. Back then, the Integer overhead was high enough to worry about, and lots of benchmark programs used take/drop. Nowadays, we can't really change the type of take without breaking just about every Haskell program. Ok, but the whole library hierarchy is pretty new, right? There is no reason for Data.FiniteMap.sizeFM to be Int. Moreover take and drop in Data.List could be redefined to take Integer without breakage etc. Aside: Is there truly a substantive amount of code that would break if this was switched? Doesn't type inference mean that most code would switch just fine? -Alex- _ S. Alexander Jacobson mailto:[EMAIL PROTECTED] tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: sizeFM type
QUESTION: I read in a newspaper that in l981 you said '640K of memory should be enough for anybody.' What did you mean when you said this? ANSWER: I've said some stupid things and some wrong things, but not that. No one involved in computers would ever say that a certain amount of memory is enough for all time. http://www.wired.com/news/print/0,1294,1484,00.html Dell's Poweredge servers address up to 32GB of memory today! There are already 5.7 billion people on the planet (2^31) and 741 million phone lines. In my mind, there is NO QUESTION that 2^31 keys is a reasonable size for a FiniteMap or will be in the very very near future. Moreover, it is not clear that the CPU/memory overhead of returning Integer rather than Int for sizeFM is sufficiently high to be worth bothering the programmer about. -Alex- _ S. Alexander Jacobson mailto:[EMAIL PROTECTED] tel:917-770-6565 http://alexjacobson.com On Sun, 25 Apr 2004, Duncan Coutts wrote: On Sun, 2004-04-25 at 14:32, Serge D. Mechveliani wrote: Dear GHC developers, Probably, it is better to provide Integer or Integral a = a instead of Int in the function sizeFM :: FiniteMap k e - Int What do you think of this? Are you planning to put more than 2^31 entries into your FiniteMap? I don't think I could afford a machine with the 16GB of ram necessary to do that. I guess this same argument took place over the Prelude.length function. The conclusion was to add List.genericLength :: Num a = [b] - a Duncan ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
FAQ: How to Use Extensible Records in GHCi
I feel like I have way too much code of the form: changeGpart (C a b c d e f g h i) g' = C a b c d e f g' h i So, I got excited reading Simon and Mark's Lightweight Extensible Records For Haskell paper as a way to get rid of this cruft. I immediately started GHCi, typed {a=Hello world}, and got an error. Is the feature described in the paper just a proposal or is there a switch somethere to enable it? Alternatively, perhaps this code is a common beginner mistake due to ignorance of the proper idiom... -Alex- _ S. Alexander Jacobson mailto:[EMAIL PROTECTED] tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
:kind feature request in ghci
I keep running into kind errors (see my most recent post on Haskell cafe). Would it be possible for ghci to expose a :kind function that operates on types the way :type operates on values? Alternatively, is there another way to figure out how to create an instance of a class like this? class MyClass a b where emptyVal::a b Here are one of the thing that don't work: type MyType a = [a] instance MyClass (MyType a) a where emptyVal=[] And I have no idea why... -Alex- _ S. Alexander Jacobson mailto:[EMAIL PROTECTED] tel:917-770-6565 http://alexjacobson.com ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Happy and Macros (was Re: ANNOUNCE: Happy 1.10 released)
Combining two threads... Like macros and preprocessors, Happy generates code. I assume the justification for this is that hand-coding a parser in Haskell is presumed to be too difficult or that it is too hard to get the right level of abstraction (and therefore a macro-like facility is required). However, I've also used Hutton Meijer style monadic parsers and found them extremely elegant, clean, and easy to use in both Haskell and Python (though in Python they were too slow for my xml application -- function call overhead is _very_ high in Python). I am not a parsing expert, but given the recent discussion on macros, I have to ask: why use happy rather than monadic parsing? Monadic parsing allows you to avoid a whole additional language/compilation step and work in Hugs (where you don't have a makefile). What does Happy buy you here? goingovermyhead And generalizing from the above, since Monads/Arrows are types that describe a computation declaratively and Macros are functions that describe a computation procedurally, is it possible that, for any application of Macros, you can find a suitable Monad/Arrow? Or am I not understanding either well enough? /goingovermyhead -Alex- ___ S. Alexander Jacobson Shop.Com 1-646-638-2300 voiceThe Easiest Way To Shop (sm) ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users