Re: An answer and a question to GHC implementors [was Re: How to make Claessen's Refs Ord-able?]
On Tue, Apr 09, 2002 at 11:06:14AM +0100, Simon Marlow wrote: > > this usage of unsafePerformIO is such a staple of real-world Haskell > > programming, it seems there should be some language (or experemental > > compiler *wink wink ghc nudge*) support for it. I am not sure > > what form > > it would take though. > > > I did wonder once whether IO monad bindings should be allowed at the > top-level of a module, so you could say > > module M where > ref <- newIORef 42 wow. i really like this, I was thinking about something similar, but did not want to have to introduce new syntax. using <- seems to make sense here. > and the top-level IO would be executed as part of the module > initialization code. This solves the problems with unsafePerformIO in a > cleanish way, but would add some extra complexity to implementations. > And I'm not sure what happens if one top-level IO action refers to other > top-level IO bindings (modules can be recursive, so you could get loops > too). > > > > getGlobalVar :: IO (IORef Int) > > getGlobalVar = memoIO (newIORef 42) > > > > note that this is not exactly the same since getting the global var is > > in the io monad, but that really makes sense if you think > > about it. and > > chances are you are already in IO if you need an IORef. > > This doesn't really solve the problem we were trying to solve, namely > that passing around the IORef everywhere is annoying. If we were happy > to pass it around all the time, then we would just say > >main = do > ref <- newIORef 42 > ... pass ref around for ever ... we wouldnt have to pass it around all the time with this scheme, you would do something like getGlobalVar :: IO (IORef Int) getGlobalVar = memoIO (newIORef 42) now you can use it anywhere as.. inc = do v <- getGlobalVar modifyIORef v (+ 1) here is my simple implementation of memoIO which seems to do the right thing. (at least under ghc) memoIO :: IO a -> IO a memoIO ioa = do v <- readIORef var case v of Just x -> return x Nothing -> do x <- ioa writeIORef var (Just x) return x where var = unsafePerformIO $ newIORef Nothing -- --- John Meacham - California Institute of Technology, Alum. - [EMAIL PROTECTED] --- ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: ANNOUNCE: GHC 5.03.20020410 snapshot released
> Another snapshot along the 5.03 line, we expect this to be the last > snapshot before 5.04. As before, there are NO GUARANTEES as to the > stability of this release, but it has passed our three-stage bootstrap > and all but one(!) of the 754 regressions tests passed. > Documentation is > also still lagging behind the new features. > > Get it from the usual place: > > http://www.haskell.org/ghc/ The snapshot source distribution has now been updated to include the file mk/package.mk which was missing the first time around. Cheers, Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: ANNOUNCE: GHC 5.03.20020410 snapshot released
> > Another snapshot along the 5.03 line, we expect this to be the last > > snapshot before 5.04. As before, there are NO GUARANTEES as to the > > stability of this release, but it has passed our > three-stage bootstrap > > and all but one(!) of the 754 regressions tests passed. > Documentation is > > also still lagging behind the new features. > > Hi, > > I tried > > ./configure --prefix=$HOME/Lang > make all > > but the latter command fails with: > > mk/target.mk:45: mk/package.mk: Datei oder Verzeichnis nicht gefunden > make: *** No rule to make target `mk/package.mk'. Stop. Sigh, I'll re-roll the source dist. Thanks for pointing it out. Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: ANNOUNCE: GHC 5.03.20020410 snapshot released
> Another snapshot along the 5.03 line, we expect this to be the last > snapshot before 5.04. As before, there are NO GUARANTEES as to the > stability of this release, but it has passed our three-stage bootstrap > and all but one(!) of the 754 regressions tests passed. Documentation is > also still lagging behind the new features. Hi, I tried ./configure --prefix=$HOME/Lang make all but the latter command fails with: mk/target.mk:45: mk/package.mk: Datei oder Verzeichnis nicht gefunden make: *** No rule to make target `mk/package.mk'. Stop. > ls mk/ boilerplate.mk config.h config.mk opts.mk stamp-htarget.mk bootstrap.mkconfig.h.in config.mk.in paths.mk suffix.mk Am I missing something obvious? Cheers, Ralf ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
ANNOUNCE: GHC 5.03.20020410 snapshot released
Another snapshot along the 5.03 line, we expect this to be the last snapshot before 5.04. As before, there are NO GUARANTEES as to the stability of this release, but it has passed our three-stage bootstrap and all but one(!) of the 754 regressions tests passed. Documentation is also still lagging behind the new features. Get it from the usual place: http://www.haskell.org/ghc/ Changes since the previous snapshot (5.03.20020204): * GHC switched over to the new hierarchical library structure for its base libraries. The old hslibs and the standard Haskell 98 libraries are still there, so you shouldn't notice any difference for existing code. We're currently working on documenting the new library structure for the next release. * The syntax for implicit parameters has changed: implicit bindings are now introduced with the let keyword instead of with. The bindings in a let must be either all implicit bindings or all explicit, not a mixture of the two. The old with syntax will be supported for a couple of versions or so, but will elicit a warning message from the compiler if you use it. * Foreign export dynamic is allegedly working in GHCi. * Generics are working again. * Explicit kind annotations can now be given on type variables. See the documentation (type system extensions, explicitly-kinded quantification) for more details. * Interface files are now in a binary format for speed of reading/writing. Use ghc --show-iface to show the textual representation of an interface. The synatx of .hi-boot files has changed, and is now much more readable. Cheers, Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
register error
While trying to install GHC-5.02.3 (win32 release) in my computer (Windows 98), I got the following error message: Error 1406: Could not write value _MainFeature to key HKEY_LOCAL_MACHINES\Software\Microsoft\Windows\CurrentVersion\Installer\Feat ures\8C655693FA0801D4E87FA1CA60C4AAE1 Verify that you have sufficient access to that key, or contact your support personel. I then finished the installation, and would like to ask 2 things: 1. What problems am I supposed to expect with this error? 2. Why this happened? I though I had sufficient access to all needed register keys... :) Thanks, -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users