[Haskell-cafe] Re: Sometimes I wish there was a global variable

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Mar 22 19:54:19 EDT 2009


On 2009 Mar 22, at 19:10, Rafael Cunha de Almeida wrote:
> Doing it like that I could have all the definitions in one module, but
> it doesn't solve another important problem: keyboardMouse and display
> functions have to have as many parameters as there are IORefs.

Or a single argument which holds all IORefs.  Or record-style pattern  
matching:

> If I wanted to add a new IORef I'd have to do something like:
> 	keyboard var1 _ _ LeftKey = ...
> 	keyboard _ var2 _ RightKey = ...
> 	keyboard _ _ var3 RightKey = ...

keyboard {v = var1} LeftKey  = ...
keyboard {v = var2} RightKey = ...

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090322/7e8fbd25/PGP.bin


More information about the Haskell-Cafe mailing list