SFML-haskell / SFML

Low level Haskell bindings for SFML 2.x
MIT License
41 stars 11 forks source link

Typeclass for size #18

Open RageYL opened 9 years ago

RageYL commented 9 years ago

Hi

I want to create a typeclass that would provide function to get/set the size/width/height. At first i was thinking about RenderTexture and RenderWindow only. (one issue is that RenderTexture cannot set the size, so making two typeclasses would probably be better) while i was looking at the source i found that some types, like RectangleShape already had setSize/getSize. it would be nice to make those types instance of the typeclass. but RectangleShape have size expressed in Float and RenderWindow in Int. the only way to make it works (that i know) would be to use MultiParamTypeClasses, but i don't know if you would accept such a flag.

I just wanted to have your thoughs about that: should i stop, should i try another approach... Thanks

jeannekamikaze commented 9 years ago

The approach you mention looks good to me. I am fine with any extensions as long as they don't introduce type inference ambiguities or over-complicate the bindings. My only other personal constraint is that the code should compile on the latest Ubuntu with stock ghc - 7.8.4 as of today - for the sake of officially supporting a linux distro.