[Haskell-cafe] type inference futility

Paul Wankadia junyer at gmail.com
Mon Apr 16 05:05:57 EDT 2007

The following code has ambiguity, but I can't figure out how to get
around it.  Am I missing something trivial?  Am I going in the wrong
direction?  Thank you in advance for your time and for any help that
you can offer.

> data MehQueue = MehQueue
> class MehBase a where new :: IO a
> instance MehBase MehQueue where new = return MehQueue
> class (MehBase a) => HasShift a where shift :: a -> IO a
> instance HasShift MehQueue where shift a = return a
> main :: IO ()
> main = do
>         x <- new
>         shift x
>         return ()

Please note that I intend to extend this example with MehStack,
HasPush and HasPop.  You can probably guess where I'm going with all

More information about the Haskell-Cafe mailing list