haskell-opengl / OpenGL

Haskell bindings to OpenGL
http://www.haskell.org/haskellwiki/OpenGL
BSD 3-Clause "New" or "Revised" License
147 stars 26 forks source link

DatatypeContexts is required by Graphics.Rendering.OpenGL.GL.Evaluators #25

Closed coreyoconnor closed 12 years ago

coreyoconnor commented 12 years ago

Adds using a LANGUAGE pragma

dagit commented 12 years ago

Hello,

Could you please explain the motivation for this change?

Thanks, Jason

coreyoconnor commented 12 years ago

With GHC 7.2.1 the DataTypeContexts extension was deprecated but was on by default. In GHC 7.4.1 the DataTypeContexts extension is now off by default. This patch re-enables the extension just for that file. Which enables the file to compile under 7.4.1. The change should have no effect on 7.2.1. A separate patch would be to remove the use of a data type context and use GADTs.

dagit commented 12 years ago

Oh, thank you very much for pointing this out. I haven't been able to test with 7.4 yet (just built it yesterday).

I think -XDataTypeContexts was added too recently to use it. It appears in the 7.x documentation, but I can't find it mentioned here for 6.12-latest: http://www.haskell.org/ghc/docs/6.12-latest/html/users_guide/release-6-12-2.html

I'd like to avoid breaking older GHCs, when possible. Which also implies we really need some build slave infrastructure setup so that we can tell when these sorts of things will break. We have such an infrastructure at work, I wonder if I could piggy back on it (but then it wouldn't be publicly visible :( GADTs are notorious for changing a bit between releases so I'd also prefer to avoid them.

I have to think about this a bit more. For example, can we simply remove the data type contexts in this case without changing the semantics (typically that's the case).

Thanks, Jason

On Sat, Feb 4, 2012 at 11:29 AM, Corey O'Connor reply@reply.github.com wrote:

With GHC 7.2.1 the DataTypeContexts extension was deprecated but was on by default. In GHC 7.4.1 the DataTypeContexts extension is now off by default. This patch re-enables the extension just for that file. Which enables the file to compile under 7.4.1. The change should have no effect on 7.2.1. A separate patch would be to remove the use of a data type context and use GADTs.


Reply to this email directly or view it on GitHub: https://github.com/haskell-opengl/OpenGL/pull/25#issuecomment-3812579

dagit commented 12 years ago

I fixed this by removing the data type context. New version is up on hackage. Thanks for reporting this issue!

coreyoconnor commented 12 years ago

Excellent! Even better than adding the extension. :-) I believe data type contexts were deprecated because they had no real effect (Well, not the anticipated effect) So in most cases data type contexts can be removed without issue.