RE: floating point literals
Simon Marlow wrote: On Mon, Mar 17, 2003 at 10:33:47AM +, Ross Paterson wrote: GHC doesn't recognize literals like 9e2, and nor does lex. Correction: GHC doesn't recognize 9e2 lex is confused by 0xy, 0oy, 9e+y and 9.0e+y Fixed GHC, I'll leave lex to someone more familiar with the code... Cheers, Simon Forgive me if I'm confused, but I thought 9e2 was supposed to be parsed as two lexemes, 9 and e2. This changed in the revised version of Haskell 98. I hadn't noticed, hence GHC was still parsing the old H98 syntax. The change dates back to November 2001, and is listed on Simon's Errata page, here: http://research.microsoft.com/Users/simonpj/haskell98-revised/haskell98- bugs.html Cheers, Simon ___ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: building 5.04.3 on sparc-solaris-2.6
I'm trying to build ghc-5.04.3 from source on a sparc-solaris-2.6 machine, using 5.02.3. It throws up the following build error. Any ideas what might be going wrong? /tmp/ghc11170.hc: In function `SystemziTime_zdLrpHVeta_entry': /tmp/ghc11170.hc:10508: called object is not a function If it helps, here is the relevant section of the .hc file. Line 10508 is marked with a comment. System/Time.hc INFO_TABLE(SystemziTime_zdLrpHVeta_info,SystemziTime_zdLrpHVeta_entry,0,2,THUNK_STATIC,,EF_,0,0); FN_(SystemziTime_zdLrpHVeta_entry) { StgAddr _B2_; FB_ HP_STK_CHK_NP(4,3,1,); SET_HDR_(Hp-2,(P_)stg_CAF_BLACKHOLE_info,0,0); UPD_CAF(R1.p,Hp-2); PUSH_UPD_FRAME(Hp-2,0); Sp[-4]=(W_)((P_)srBl_info); Sp=Sp-4; { StgAddr _ccall_result; CALLER_SAVE_SYSTEM _ccall_result = (timezone()); /* line 10508 */ CALLER_RESTORE_SYSTEM _B2_=_ccall_result; } R1.a=_B2_; JMP_(ENTRY_CODE((P_)(*Sp))); FE_ } My guess is that timezone() is not a function on Solaris 2.6. Indeed, grepping through /usr/include shows that time.h defines extern long timezone; Regards, Malcolm ___ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
RE: building 5.04.3 on sparc-solaris-2.6
I'm trying to build ghc-5.04.3 from source on a sparc-solaris-2.6 machine, using 5.02.3. It throws up the following build error. Any ideas what might be going wrong? /tmp/ghc11170.hc: In function `SystemziTime_zdLrpHVeta_entry': /tmp/ghc11170.hc:10508: called object is not a function If it helps, here is the relevant section of the .hc file. Line 10508 is marked with a comment. System/Time.hc INFO_TABLE(SystemziTime_zdLrpHVeta_info,SystemziTime_zdLrpHVet a_entry,0,2,THUNK_STATIC,,EF_,0,0); FN_(SystemziTime_zdLrpHVeta_entry) { StgAddr _B2_; FB_ HP_STK_CHK_NP(4,3,1,); SET_HDR_(Hp-2,(P_)stg_CAF_BLACKHOLE_info,0,0); UPD_CAF(R1.p,Hp-2); PUSH_UPD_FRAME(Hp-2,0); Sp[-4]=(W_)((P_)srBl_info); Sp=Sp-4; { StgAddr _ccall_result; CALLER_SAVE_SYSTEM _ccall_result = (timezone()); /* line 10508 */ CALLER_RESTORE_SYSTEM _B2_=_ccall_result; } R1.a=_B2_; JMP_(ENTRY_CODE((P_)(*Sp))); FE_ } Hmm, looks like the Time library has got the timezone stuff wrong for your system. What does mk/config.h say about HAVE_ALTZONE? On a Solaris 8 box I'm looking at it says HAVE_ALTZONE is defined. My guess is that timezone() is not a function on Solaris 2.6. Indeed, grepping through /usr/include shows that time.h defines extern long timezone; Does it also define altzone? Cheers, Simon ___ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: building 5.04.3 on sparc-solaris-2.6
_ccall_result = (timezone()); /* line 10508 */ What does mk/config.h say about HAVE_ALTZONE? On a Solaris 8 box I'm looking at it says HAVE_ALTZONE is defined. $ grep ZONE mk/config.h /* #undef HAVE_ALTZONE */ /* #undef HAVE_TIMEZONE */ #define TYPE_TIMEZONE time_t /* #undef HAVE_STRUCT_TM_TM_ZONE */ /* #undef HAVE_TM_ZONE */ Because they are commented out, I don't know whether that means HAVE_ALTZONE and HAVE_TIMEZONE are defined - probably not I would guess? grepping through /usr/include shows that time.h defines extern long timezone; Does it also define altzone? Yes, as an extern long. At least, I think so. It is kind of difficult to tell, because of the multiplicity of #ifdefs to support various older versions of the Sun C compiler. Here is what I can extract from time.h that might be relevant: #if defined(__STDC__) # if defined(__EXTENSIONS__) || __STDC__ == 0 || \ defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) #if defined(__EXTENSIONS__) || (__STDC__ == 0 \ !defined(_POSIX_C_SOURCE)) || defined(_XOPEN_SOURCE) extern long timezone; #endif # endif # if __STDC__ == 0 !defined(_POSIX_C_SOURCE) !defined(_XOPEN_SOURCE) extern long altzone; # endif #else extern long timezone, altzone; #endif and here is what gcc reckons is defined: $ gcc -E -dM -x c /dev/null #define __GCC_NEW_VARARGS__ 1 #define __sparc 1 #define __svr4__ 1 #define __GNUC_MINOR__ 95 #define __sun 1 #define sparc 1 #define __sun__ 1 #define __unix 1 #define __unix__ 1 #define __SVR4 1 #define sun 1 #define __GNUC__ 2 #define __sparc__ 1 #define unix 1 which doesn't include __STDC__, meaning that the final declaration should hold. Unless the following definition from mk/config.h overrides that? #define STDC_HEADERS 1 Anyway, I changed mk/config.h to add #define HAVE_ALTZONE #define HAVE_TIMEZONE and received the same error. I will now `make clean' and rebuild from scratch, to see if it makes any difference. Regards, Malcolm ___ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: building 5.04.3 on sparc-solaris-2.6
* Malcolm Wallace [EMAIL PROTECTED] [2003-03-19T14:33+]: Anyway, I changed mk/config.h to add #define HAVE_ALTZONE #define HAVE_TIMEZONE and received the same error. I will now `make clean' and rebuild from scratch, to see if it makes any difference. You may have to copy (and modify) config.h to ghc/includes as well. See ghc/includes/Makefile Cheers, Michael ___ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
RE: trouble linking with -O and unboxed tuple
With ghc 5.04.2 I'm having some trouble linking (debian linux). Here's the error I get: /home/bjpop/woo/lib/buddha-0.5/libbuddha_p.a(Partial.o): In function `s1jZ_fast1': Partial.o(.text+0xa44): undefined reference to `GHCziPrim_zdwZ2H_entry' Ok, could you help us out by doing the following: compile Partial.o, using exactly the same flags you were using to demonstrate the problem, but add -ddump-simpl -dppr-debug -ddump-stg and send us the output. Also the source for the module would help too. Cheers, Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Type Inference Infelicity
This should compile, shouldn't it? -- ghc -c -fglasgow-exts TestInfer.hs module TestInfer where { class C t a b | t a - b; instance C Char a Bool; data P t a = forall b. (C t a b) = MkP b; data Q t = MkQ (forall a. P t a); f' :: Q Char; f' = MkQ (MkP True :: forall a. P Char a); f :: Q Char; f = MkQ (MkP True); } GHC 5.04.2 for MacOS X complains about f, but not about f': TestInfer.hs:15: Could not deduce (C t a Bool) from the context () Probable fix: Add (C t a Bool) to the When generalising the type of an expression Or add an instance declaration for (C t a Bool) arising from use of `MkP' at TestInfer.hs:15 In the first argument of `MkQ', namely `(MkP True)' In the definition of `f': MkQ (MkP True) -- Ashley Yakeley, Seattle WA ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: fun with sockets (ghc-5.04.1)
Peter, [...] After processing a random number of connections, the server dies with Fail: invalid argument Action: accept Reason: Invalid argument [...] I don't know what's wrong, I'm afraid. Any chance you could supply us with a working example that demonstrates the bug? Cheers, Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: How do I profile Prelude functions?
Alistair, I can't find advice in the GHC manual on determining how much time your program spends in Prelude functions. I've discovered that I can alias a Prelude function e.g. import Data.Set myMkSet = mkSet ... which will give me a cost-centre for mkMySet. Isn't there an easier way to do this? Sorry for the delay in answering your question. We should really turn on -auto-all when compiling the libraries for profiling, but we don't for several reasons: (a) it affects optimisations (b) it makes profiles harder to read (c) it makes the libraries a lot larger these are all things we should fix (well, at least (a) and (b)). For (b), we really need a better tool for viewing the profiles: I have a prototype for such a tool which uses Gtk+HS, which I'll try to incorporate at some point. You can of course compile up your own libraries with -auto-all turned on. Or alternatively, just use the workaround you discovered. Cheers, Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: fun with sockets (ghc-5.04.1)
In local.glasgow-haskell-users, you wrote: After processing a random number of connections, the server dies with Fail: invalid argument Action: accept Reason: Invalid argument [...] I don't know what's wrong, I'm afraid. Any chance you could supply us with a working example that demonstrates the bug? I was on this for some time and even received an strace from Peter -- which DIDN'T show EINVAL at all on any accept! He keeps seeing 'Evacuated object entered' messages on other runs, so he might be experiencing a more severe problem. Reproducing this with a recent ghc would be better, I guess... BTW: There's a tracing primer at http://www-i2.informatik.rwth-aachen.de/~stolz/Haskell/networking.txt which explains some of the things you might find strange in traces (ioctl TCGETS anyone?). Not quite finished and open for suggestions... Volker -- http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME rage against the finite state machine ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Class or parameterized type?
At 18:42 18/03/2003 -0800, [EMAIL PROTECTED] wrote: Example: I wish to define a structured container type, let's call it a RatsNest, that is type-variable in two ways: [...] Do you consider the standard design lacking? For example, I wasn't aware there was a standard design, but you have given me some pointers. Thanks! Studying your code was very interesting for me, as it has shown me something more of the kinds of idiom that work with Haskell. Concerning my question, I think the key part of your code is in: [[ class (RatTail t) = RatNest c t where ]] which I think is exactly what I was looking for, and is not a Haskell structure I've come across before. (I assume that this form does not indicate that RatNest... is a subclass of RatTail (as opposed to saying (RatTail t) = RatNest t); I certainly wouldn't want to have that.) I suppose this is the multi-parameter type class extension you mentioned. Can you say where this extension is described, and how widely implemented it is? Thank you for your response, I found it most helpful. #g --- Graham Klyne [EMAIL PROTECTED] PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
flock and sockets
I am planning a Haskell project and I need to access files. Since the program will be automatically started whenever a mail comes in I will need to be able to lock the access to files. Is there any support for this in some library? The second option that I have is to use a daemon and let the programs that get started by mail connect via some sort of socket. Is there any socket support in Haskell? #Luna -- Daniel Luna | Top reasons that I have a beard: [EMAIL PROTECTED] | a) Laziness. http://www.update.uu.se/~luna/| b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
RE: recursive modules in Haskell
On 17-Mar-2003 Simon Peyton-Jones wrote: | there is no need to use such hacks. it is not dificult to add suport | for mutually recursive modules to an implementation directly. | unfortunatley none of the working haskell implementations support | recursive modules, Simple in principle, not so simple in practice. If it was easy to make GHC do mutually recursive modules we'd do it right away. It's certainly possible but it's real work, and .hi-boot files, while clunky, do the job. My original posting was partly aimed at Hugs, since I find it very convenient to use Hugs during development, though I finally compile the stuff with ghc. A Haskell-toHaskell precompiler would solve the problem for both Hugs and ghc. And I wasn't sure from my first look into the manual that hi-boot-Files are actually a feasible solution for mutual recursion at a greater scale. But since you both find hi-modules feasible, I'll try out them in the next version. Elke. -- Elke Kasimir EsPresto AG - - Software Development-Breite Str. 30-31 Tel/Fax: +49-30-90 226-750/-760 10178 Berlin/Germany ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: recursive modules in Haskell
Simon Peyton-Jones [EMAIL PROTECTED] writes: Nothing deep. GHC is just a fairly big thing and one of its assumptions is that it is compiling one module at a time. There'd be quite a bit of chuffing around to remove this assumption. Nothing fundamental, but real work. The other big problem is that, in the worst case, you need to typecheck the entire program (however many modules that may be) at once. If your program happens to be GHC, Lolita or one of the other big Haskell programs, this might be prohibitively expensive. A potentially lightweight alternative that Simon PJ and I talked about some time ago (1998/9?) is to break the recursion between two modules by using type signatures on top-level definitions. The idea is to generate the .hi-boot files that GHC currently uses automatically. Suppose we have a pair of mutually recursive modules A and B, we can generate A.hi-boot as follows: - read all of A and B discarding all function bodies as we go. [It might be possible to avoid reading B - depending on how much checking is performed at this stage.] - check all the type, class and instance definitions in A and B - keep the type signatures for exported definitions from A, discard everything else [At this point, GHC would normally start typechecking function bodies and generating code but we can stop now because all we need to do is generate the .hi-boot file.] - write A.hi-boot This approach gives most of what we need from recursive modules. It has the advantage that it probably doesn't take too much effort to add to a compiler that already uses interface files. The big disadvantage is that you have to provide type signatures for any definitions involved in cyclic module dependency. This may not be too bad since Haskell style guides suggest that you should provide type signatures for all exported top-level definitions. -- Alastair Reid [EMAIL PROTECTED] Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/ ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
RE: flock and sockets
I am planning a Haskell project and I need to access files. Since the program will be automatically started whenever a mail comes in I will need to be able to lock the access to files. Is there any support for this in some library? Yes, the Posix library distributed with GHC has support for file locking. See http://www.haskell.org/ghc/docs/latest/html/hslibs/sec-posix.html This library is currently undergoing a rewrite - the functionality will be available under System.Posix in future releases of GHC (and possibly Hugs NHC). The second option that I have is to use a daemon and let the programs that get started by mail connect via some sort of socket. Is there any socket support in Haskell? Yes: http://www.haskell.org/ghc/docs/latest/html/network/index.html (currently only available with GHC). Cheers, Simon ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: recursive modules in Haskell
hi, Alastair Reid wrote: Simon Peyton-Jones [EMAIL PROTECTED] writes: Nothing deep. GHC is just a fairly big thing and one of its assumptions is that it is compiling one module at a time. There'd be quite a bit of chuffing around to remove this assumption. Nothing fundamental, but real work. that's reasonable. incidently i think (but am not 100% on this) that one can still do most of the work one module at a time. it seems that only type checking needs to happen one strongly connected module component at a time. The other big problem is that, in the worst case, you need to typecheck the entire program (however many modules that may be) at once. If your program happens to be GHC, Lolita or one of the other big Haskell programs, this might be prohibitively expensive. you only need to type check one strongly connected component of modules at a time. of course it could be the case that your whole program is one big strongly connected component, but that is not that easy to achieve. along those lines - it is of course possible to write a program where all *functions* are mutually recursive, but we don't usually do that. in fact it is very likely that most nontrivial programs have at least two SCCs as it is not usual to import the Main module in other moudles. and of course, most of the time modules don't need to be recusrive and then each module is in a SCC of its own. i very much doubt that GHC has more than a few modules per SCC, but perhaps one of the simons can give us a more definitive answer on that. bye iavor -- == | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | == ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
History of Haskell, first draft
Hello, a first draft of my little Haskell-history collection is online now: http://pseiko.gmxhome.de/pseiko/Haskell-History.html Please note, that one part is still just copied from http://www.idt.mdh.se/kurser/cd5100/ht02/history.html but I hope it will evolve quickly. Moreover some parts are still missing. So please understand it as a framework and base where all kinds of additional contributions are pluggable. A big thank you to all helpers. Ciao, Steffen ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell