All pastes #502221 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-22 12:27 UTC
rendered paste body
combine_ST_and_M = do
 lift (fooM undefined) --fooM is something of type a -> M a s ()
 ref <- lift $ new_ref "A"
 return ref 

why doesn't this work?

    Couldn't match expected type `M a s'
	   against inferred type `ST s1'
      Expected type: t1 (M a s) t
      Inferred type: t1 (ST s1) (STRef s1 [Char])
    In a 'do' expression: ref <- lift $ (new_ref "A")
    In the expression:
	do a <- lift (fooM undefined)
	   ref <- lift $ (new_ref "A")
	   return ref