Adding an ignore function to Control.Monad

Gwern Branwen gwern0 at gmail.com
Wed Jun 10 15:05:09 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Wed, Jun 10, 2009 at 1:13 PM, Isaac Dupree wrote:
> On the other hand, maybe it's also an argument to change all the functions
> like forkIO from
> :: IO () -> IO ThreadID
> to
> :: IO a -> IO ThreadID
>
> I mean, surely they don't rely on the value of a () return-type, other than
> to pass on to other places that artificially require the ()-type?
>
> okay, a hypothetical function
> twice :: IO () -> IO ()
> twice a = a >> a
> would really need not to return the second result arbitrarily (as it would
> have to with a mere type-change, to "IO a -> IO a"), so it could be
> twice :: IO a -> IO ()
> twice a = ignore (a >> a)

I think generalizing forkIO is a great idea; but I wanted to do one
change at a time. Keep the discussion on just 'ignore', and only moot
about a forkIO change when 'ignore' is finished up.

- --
gwern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEAREKAAYFAkowA+QACgkQvpDo5Pfl1oI0fQCeJcuHxWD8M9f5ZkAB6egfrZWI
FE4An1GspyC3jENzZ8Vvr6FUsurMgSJd
=QmIu
-----END PGP SIGNATURE-----


More information about the Libraries mailing list