Re: unsafePerformIO safety.
I wouldn't like if unsafePerformIO could never be inlined, sometimes you want it inlined for performance. And not all uses are hacky, it's just that when I use it, then burden is on me to convince myself that it is safe. On Mar 6, 2007, at 23:56 , Neil Mitchell wrote: Hi On 3/6/07, Lennart Augustsson [EMAIL PROTECTED] wrote: Yeah, you really need {-# NOINLINE var #-} to make it reasonable safe. Couldn't GHC bake in knowledge about unsafePerformIO, and never inline it? It is a slightly hacky solution, but since unsafePerformIO is pretty much only used in hacks, I think its almost fitting. Thanks Neil ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: unsafePerformIO safety.
Lennart Augustsson wrote: I wouldn't like if unsafePerformIO could never be inlined, sometimes you want it inlined for performance. And not all uses are hacky, it's just that when I use it, then burden is on me to convince myself that it is safe. unsafePerformIO is currently not inlined - there's a NOINLINE pragma on its definition in GHC.IOBase, and some comments in there to explain why. You're right that sometimes you really want it to be inlined - this is why there's a function called inlinePerformIO in Data.ByteString.Base, for example. You'd better really know what you're doing before using that one, though :-) Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: unsafePerformIO safety.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Simon Marlow wrote: You're right that sometimes you really want it to be inlined - this is why there's a function called inlinePerformIO in Data.ByteString.Base, for example. You'd better really know what you're doing before using that one, though :-) yep, it should be generally available as unsafeInlineUnsafePerformIO (-: It's especially unsafe because... all of the IO might not be executed, due to lazy evaluation + optimization? Some of the IO might be run twice without other parts of it being so? Isaac -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF7p9jHgcxvIWYTTURAqAKAKCu8dJ4rpyMcMH7ebPv0HfIUyGSgACgy0Jq naeTCZk/2xZraOrSJtyObm8= =oKKG -END PGP SIGNATURE- ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
[HDirect] ihc and COM
Hi, I'm continuing to experiment with HDirect and the ihc compiler. Trying the huge type libraries from Office applications (Word, Excel...), I've met the following issue: some Haskell stubs do not compile out of the box, essentially because of type mismatch between the type signature generated by the ihc compiler and the stub's code. For instance: Excel.hs:32:25: No instance for (Automation.Variant a0) arising from use of `Automation.outVariant' at Excel.hs:32:25-45 Possible fix: add (Automation.Variant a0) to the type signature(s) for `global_getActiveCell' The faulty declaration is indeed : global_getActiveCell :: Global a1 - Prelude.IO a0 global_getActiveCell = Automation.propertyGet ActiveCell [] Automation.outVariant whereas the correct type is (Automation.Variant a0) = Global a1 - Prelude.IO a0 There are also some cases where there is a type mismatch between Int64 and Automation.Date type, but the essence of the error is the same : the type signature does not match the method's stub's code. I've looked for an option in the compiler that would help (for instance, I suppose that removing all type signatures from the haskell file would allow to compile it), but I haven't found one. NB : the ihc command line was ../src/ihc.exe --tlb -fautomation -fprefix-interface-name -fmaybe-optional-params -v XL5EN32.OLB (where the OLB file is Excel's type library). Did anyone experienced similar issue ? Thanks in advance, sL PS: the COM library (without Automation) works well. ___ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users