
On Fri, Dec 03, 2004 at 11:16:19AM -0600, John Goerzen wrote:
On Fri, Dec 03, 2004 at 11:59:23AM -0500, Scott Turner wrote:
On 2004 November 30 Tuesday 11:04, John Goerzen wrote:
type CPResult a = MonadError CPError m => m a
You've got an existential type here. (Was that the intent?)
Yes. It was so that I could make the return types of some various functions easier to type and deal with. Problem with using a data type is that the result is no longer directly in MonadError, nor usable as an Either. I wound up just manually expanding it. Thanks, though, for the feedback.
This is where I find ghc's newtype deriving to be incredibly useful. newtype CPError a = CPError (Either Error a) deriving(Monad,MonadError) now CPError is a monad and an instance of MonadError and you are free to override or inherit more interesting instances at will without conflicting with the basic types for Either :) I have come to the conclusion that 'type' is rarely a good idea when you have the newtype deriving trick available to you. (of course, others come to different conclusions so take with a grain of salt) John -- John Meacham - ⑆repetae.net⑆john⑈