
16 Apr
2007
16 Apr
'07
5:05 a.m.
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 this.