[Haskell-cafe] MonadGL - Partitioning effects without giving up type inference

2007-09-13 Thread Jules Bean
The OpenGL bindings which come bundled with ghc are a really great example of how even an almost-literal port of a C API can still be easier to work with in haskell than it is in C, because of the benefits of type inference and powerful abstractions. Even the ability to mapM_ is a tool to make C

Re: [Haskell-cafe] MonadGL - Partitioning effects without giving up type inference

2007-09-13 Thread Derek Elkins
On Thu, 2007-09-13 at 19:34 +0100, Jules Bean wrote: Any comments? I'm sure this has been shown before but I don't remember where. The Monad Transformer Library essentially does this, the types you get are along the lines of: foo :: (Monad m, MonadState s m, MonadReader r m) = m Int

Re: [Haskell-cafe] MonadGL - Partitioning effects without giving up type inference

2007-09-13 Thread Stuart Cook
On 9/14/07, Jules Bean [EMAIL PROTECTED] wrote: {-# OPTIONS -fglasgow-exts #-} (extensions are only for deriving (Monad), it's not important) If that's the case, you should be able to write (assuming GHC 6.6+) {-# LANGUAGE GeneralizedNewtypeDeriving #-} though I don't know how well other