[Haskell-cafe] Announce: HSFFIG 1.0 Stable Release
Dear List Subscribers, I am pleased to announce the first stable release of HSFFIG, yet another tool for autogeneration of FFI bindings from C include files. The project is now hosted at Sourceforge: http://hsffig.sourceforge.net Downloads page: http://www.sourceforge.net/projects/hsffig Darcs repo: darcs get http://hsffig.sourceforge.net/repos/hsffig-1.0 Tutorial: http://www.haskell.org/hawiki/HsffigTutorial The wiki page "HsffigExamples" has been separated from the Tutorial. If anybody has an interesting example of using HSFFIG please update the page with code samples. Brief summary of changes: - The distribution is now cabalized. Please read the INSTALL file. - The multiparameter class and combinators to access members of structures/unions are moved to separate library. It is necessary to specify -package HSFFIG when compiling applications. Thanks to everybody who participated in discussions related to HSFFIG on this list, and privately. This helped me with implelentation of some features and gave some ideas for future improvement. Debian, RPM, and other packagers: if you create a HSFFIG package please let me know the package URL so I can update the Freshmeat project information page, and the project homepage. For any problems related to this project feel free to contact me. -- Dimitry Golubovsky ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using unsafePerformIO
"Dinh Tien Tuan Anh" <[EMAIL PROTECTED]> writes: > will be written without unsafePerformIO: >co' (x:xs) = do > c1 <- co' xs > c<- f (x:xs) > if (c==1) > then return 1:c1 > else return 0:c1 > You might want to use unsafeInterleaveIO :: IO a -> IO a. It allows IO computation to be deferred lazily. In the particular example co' (x:xs) = do c1 <- unsafeInterleaveIO (co' xs) c <- f (x:xs) if (c==1) then return (1:c1) else return (0:c1) - Einar Karttunen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using unsafePerformIO
So that's not safe, and thus it should be in the IO monad. How can i handle a lazy list with IO monad. For example, function co (x:xs) ¦c ==1 = 1:co (xs) ¦c == 2 = 0:co (xs) where c = unsafePerformIO(f (x:xs)) will be written without unsafePerformIO: co' (x:xs) = do c1 <- co' xs c<- f (x:xs) if (c==1) then return 1:c1 else return 0:c1 AFAICS, co' does not do lazy evaluation, so wont print any element of the list. Can lazy evaluation be integrated with IO monad ? Cheers TuanAnh _ Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using unsafePerformIO
On 8/1/05, Dinh Tien Tuan Anh <[EMAIL PROTECTED]> wrote: > > depends on value of the first two elements of the list, f1, f2 and f3 will > return three different values. So is it safe ? > If "f xs" always returns the same value for a given xs, then it's safe. Doesn't look like that's the case here, though, since depending on the GHC runtime scheduler f1 may finish first in one case, and then the next time f2 may finish first, meaning that f xs will return two different results for the same xs. So that's not safe, and thus it should be in the IO monad. /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using unsafePerformIO
AFAICS it is safe provided.. f always returns the same value for a given argument list and.. f has no observable side effects. What are called "side effects" ? It looks to me like what you're trying to do is run three parallel evaluation algorithms and take the answer from whichever one delivers an answer first (via the MVar, which should be empty initially). Yes, thats what im trying to do f1,f2,f3 all deliver the same answer (if they deliver an answer at all) and that answer depends on nothing but xs and none of them have any observable side effects then I guess you're probably safe. depends on value of the first two elements of the list, f1, f2 and f3 will return three different values. So is it safe ? _ Winks & nudges are here - download MSN Messenger 7.0 today! http://messenger.msn.co.uk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe