{-# OPTIONS_GHC -fno-monomorphism-restriction -fallow-undecidable-instances #-}
import Data.STRef
import Control.Monad.ST

class Monad m => MonadST s m | m -> s where
     liftST :: ST s a -> m a

val :: (MonadST s m) => STRef s a -> m a
val = undefined 

-- with type signature zork works, without it suggests to use -fno-monomorphism-restriction, i.e. it doesn't work
zork :: (MonadST s m) =>  STRef s t -> m ()
zork ref_t = do
  t <- val ref_t
  (cond False
    (return ())
    (return ()))

class Cond c a  | c -> a  where
 cond:: c -> a -> a -> a

instance (Monad m) => Cond (m Bool) (m t)  where
 cond = undefined 

instance Cond Bool t where
 cond = undefined

