[Haskell-cafe] Re: Is there anyone out there who can translate
C# generics into Haskell?
Jules Bean
jules at jellybean.co.uk
Tue Jan 8 06:20:15 EST 2008
Achim Schneider wrote:
> things like
>
>
> data State = State
> { winSize :: IORef Size
> , t :: IORef Int
> , fps :: IORef Float
> , showFPS :: IORef Bool
> , showHelp :: IORef Bool
> , grabMouse :: IORef Bool
> , mousePos :: IORef (Maybe Position)
> , mouseDelta :: IORef Position
> , viewRot :: IORef Vec3
> , angle' :: IORef GLfloat
> , ballPos :: IORef Vec2
> , ballVel :: IORef Vec2
> }
Yuck!
I'm not sure whether this is a real example or not, but if it's real,
get rid of all those IORefs. Make State a simple type, and use (IORef
State) as needed for callbacks, and hide that fact in other code.
Jules
More information about the Haskell-Cafe
mailing list