[Haskell-cafe] Classes in type declarations in Hugs

Scott Turner p.turner at computer.org
Fri Dec 3 11:59:23 EST 2004

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?)
The more common syntax for this purpose uses 'data' rather than 'type', and 
uses an explicit 'forall'. 

data CPResult a = forall m. MonadError CPError m => CPResult (m a)

Hugs accepts this. (Though in the extended example I attempted, GHC mangaged 
the type inference while Hugs objected.)

More information about the Haskell-Cafe mailing list