Re: I accidentally the Prelude
On Mon, Mar 1, 2010 at 11:54 PM, Jeremy Shaw jer...@n-heptane.com wrote: is there, by chance, a file named Prelude.hs in the working directory? (the directory you are in when you type ghci?) - jeremy Ah. Thanks! That was indeed the problem. Though I think ghci:s response could be a little bit more transparent. Josef On Mon, Mar 1, 2010 at 11:43 AM, Josef Svenningsson josef.svennings...@gmail.com wrote: Hi, It seems I've been able to mess up my ghc installation pretty badly. Here is what happens if I just try to invoke ghci from the prompt: $ ghci GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. command line: module `Prelude' is not loaded $ I have no idea what I did to end up in this situation. What I've been doing lately is reinstalling some packages. I also have another ghc installed but it's at a completely different place in the file system. The only thing I can think of is if cabal managed to somehow confuse the two ghcs and wrote some data in the wrong place. What I really would like to know is if there is a simple way to fix this without completely reinstalling ghc with all the libraries I have installed. Has anyone else experienced anything similar? If this is a potential bug I'd be happy to provide any data that might help track it down. Cheers, Josef ___ 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
Re: C that setjmps - haskell - C that might longjmp
On 01/03/2010 17:06, Tyson Whitehead wrote: If I have the following call sequence C code - Haskell code - various C code bits where the various C code bits on the right might do a longjmp (their version of an exception) and jumping back to the C code on the left. eek. Is it possible to have C code on the left then somehow tell GHC to cleanup the aborted Haskell code/resume executing it with an exception, or is the only option to setjmp wrap all the various C code bits on the right? We don't have a way to do this, no. It would require some hacking in the RTS. The RTS has stashed away information about the call in progress and is expecting the call to return, so when you longjmp() the RTS will probably get very confused. For now I suggest you use setjmp. If you want to suggest an API to tell the RTS about a longjmp, then perhaps we could implement something, but I'm not sure what the API would look like, because you don't have a handle to the in-progress calls. In RTS-speak you need to tell the RTS about which Tasks have been terminated. I've actually been tinkering with this code a bit recently so there is now a structure called InCall which replaces some of what Task was for, but the idea is similar. Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: I accidentally the Prelude
On 02/03/2010 08:59, Josef Svenningsson wrote: On Mon, Mar 1, 2010 at 11:54 PM, Jeremy Shawjer...@n-heptane.com wrote: is there, by chance, a file named Prelude.hs in the working directory? (the directory you are in when you type ghci?) - jeremy Ah. Thanks! That was indeed the problem. Though I think ghci:s response could be a little bit more transparent. Sure, how about this: $ touch Prelude.hs $ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude ie. with 6.12.1 it just works. Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: I accidentally the Prelude
On Tue, Mar 2, 2010 at 12:21 PM, Simon Marlow marlo...@gmail.com wrote: On 02/03/2010 08:59, Josef Svenningsson wrote: On Mon, Mar 1, 2010 at 11:54 PM, Jeremy Shawjer...@n-heptane.com wrote: is there, by chance, a file named Prelude.hs in the working directory? (the directory you are in when you type ghci?) - jeremy Ah. Thanks! That was indeed the problem. Though I think ghci:s response could be a little bit more transparent. Sure, how about this: $ touch Prelude.hs $ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude ie. with 6.12.1 it just works. Brilliant! Thanks. Josef ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Easily generating efficient instances for classes
Hi Derive generates declarations - they can be instances, classes, data types, functions, type synonyms etc. Thanks, Neil On Mon, Mar 1, 2010 at 10:32 AM, John Lato jwl...@gmail.com wrote: From: Christian H?ner zu Siederdissen Hi, I am thinking about how to easily generate instances for a class. Each instance is a tuple with 1 or more elements. In addition there is a second tuple with the same number of elements but different type. This means getting longer and longer chains of something like (...,x3*x2,x2,0). - template haskell? - CPP and macros? Consider arrays with fast access like Data.Vector, but with higher dimensionality. Basically, I want (!) to fuse when used in Data.Vector code. (shameless plug) You may want to look at my AdaptiveTuple package, which does something very similar to this. I used Template Haskell because AFAIK neither generic approaches nor DrIFT/Derive will generate data decls. If all you need are the instances, then DrIFT or Derive would be my recommendations. Cheers, John ___ 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
Re: Easily generating efficient instances for classes
Thanks everybody for the answers. Right now, it looks like this: the indextype is abstracted out and I plan for Data.Ix and my own Data.FastIx (or however to call it). As I don't plan on creating all instances myself, Neils derive package looks good -- once I understand it completely; which I need to as I need instances of my own class. Is there a tutorial on creating instances for own stuff, or should I go by the examples like Functor? The code in AdaptiveTuple has one advantage: it looks easier to get started producing instances. (No need to get to know another package). Btw. it is a bit disappointing (for me) that Data.Ix is almost as fast as my FastIx ;-) (as in: most people don't care about the difference) Something else: was there a resource about library naming? otherwise it is going to be vector-ixtables (someone a better idea?) Thanks again, Christian On 03/02/2010 02:30 PM, Neil Mitchell wrote: Hi Derive generates declarations - they can be instances, classes, data types, functions, type synonyms etc. Thanks, Neil On Mon, Mar 1, 2010 at 10:32 AM, John Lato jwl...@gmail.com wrote: From: Christian H?ner zu Siederdissen Hi, I am thinking about how to easily generate instances for a class. Each instance is a tuple with 1 or more elements. In addition there is a second tuple with the same number of elements but different type. This means getting longer and longer chains of something like (...,x3*x2,x2,0). - template haskell? - CPP and macros? Consider arrays with fast access like Data.Vector, but with higher dimensionality. Basically, I want (!) to fuse when used in Data.Vector code. (shameless plug) You may want to look at my AdaptiveTuple package, which does something very similar to this. I used Template Haskell because AFAIK neither generic approaches nor DrIFT/Derive will generate data decls. If all you need are the instances, then DrIFT or Derive would be my recommendations. Cheers, John ___ 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
Re: I accidentally the Prelude
I would still vote for that error in the 'worst ghc error message contest'. I got it just last night with 6.13 when I tried to run the Setup.hs function in base: ~/n-heptane/projects/haskell/darcs/base-3.0.3.2 $ rm Setup.o Setup.hi ~/n-heptane/projects/haskell/darcs/base-3.0.3.2 $ ghc --make -O2 Setup.hs -o s [1 of 1] Compiling Main ( Setup.hs, Setup.o ) Setup.hs:1:1: attempting to use module `Prelude' (./Prelude.hs) which is not loaded ~/n-heptane/projects/haskell/darcs/base-3.0.3.2 $ runhaskell Setup.hs configure Setup.hs:1:1: attempting to use module `Prelude' (./Prelude.hs) which is not loaded ~/n-heptane/projects/haskell/darcs/base-3.0.3.2 $ In this case it does at least mention the path to the troublesome file. But I still have no idea why it is not loaded** (In this particular case I don't want it loaded. Though I believe there are other similar situations where I do..) ** well, from experience I know that it is 'not loaded' because it can't decide if it should load the source, or use the version installed in the package library. But the first time I saw the message, I was quite confused. But, perhaps there are other cases when this error can occur? - jeremy On Tue, Mar 2, 2010 at 5:21 AM, Simon Marlow marlo...@gmail.com wrote: On 02/03/2010 08:59, Josef Svenningsson wrote: On Mon, Mar 1, 2010 at 11:54 PM, Jeremy Shawjer...@n-heptane.com wrote: is there, by chance, a file named Prelude.hs in the working directory? (the directory you are in when you type ghci?) - jeremy Ah. Thanks! That was indeed the problem. Though I think ghci:s response could be a little bit more transparent. Sure, how about this: $ touch Prelude.hs $ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude ie. with 6.12.1 it just works. Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: I accidentally the Prelude
On 02/03/2010 15:46, Jeremy Shaw wrote: I would still vote for that error in the 'worst ghc error message contest'. I got it just last night with 6.13 when I tried to run the Setup.hs function in base: ~/n-heptane/projects/haskell/darcs/base-3.0.3.2 $ rm Setup.o Setup.hi ~/n-heptane/projects/haskell/darcs/base-3.0.3.2 $ ghc --make -O2 Setup.hs -o s [1 of 1] Compiling Main ( Setup.hs, Setup.o ) Setup.hs:1:1: attempting to use module `Prelude' (./Prelude.hs) which is not loaded ~/n-heptane/projects/haskell/darcs/base-3.0.3.2 $ runhaskell Setup.hs configure Setup.hs:1:1: attempting to use module `Prelude' (./Prelude.hs) which is not loaded ~/n-heptane/projects/haskell/darcs/base-3.0.3.2 $ Oh, the problem here is that GHC hasn't figured out that it should consider Prelude to be a local dependency of Setup, because it only looks at the imports, and Prelude is an implicit import. With Prelude not being found during dependency analysis, it wasn't compiled first, so when we got around to trying to import it we found that it was not loaded. Perhaps the implicit import of Prelude should be import base Prelude rather than import Prelude that would avoid these problems. But it would present a problem for someone who wanted to use their own Prelude. At the least I guess we should consider Prelude to be an implicit dependency during dependency analysis. What you wanted to do above was ghc --make Setup -i, incedentally. And if we fix the dependency thing, you'll still need to do that, because otherwise GHC will try to recompile the whole of base, and something else will almost certainly go wrong because there will be two Preludes. Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: C that setjmps - haskell - C that might longjmp
On March 2, 2010 06:17:46 Simon Marlow wrote: For now I suggest you use setjmp. If you want to suggest an API to tell the RTS about a longjmp, then perhaps we could implement something, but I'm not sure what the API would look like, because you don't have a handle to the in-progress calls. In RTS-speak you need to tell the RTS about which Tasks have been terminated. I've actually been tinkering with this code a bit recently so there is now a structure called InCall which replaces some of what Task was for, but the idea is similar. Thanks Simon, I haven't quite managed to wrap my head around how the os threads, haskell threads, tasks, and capabilities all fits together in the rts, so I don't have any ideas to suggest for a relevant API. I'll setjmp wrap them. I was guessing that was the most likely option. : ) Cheers! -Tyson signature.asc Description: This is a digitally signed message part. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users