Re:Ruby's Proposed STM
by a1369209993 on Saturday October 31, 2020 @07:10PM
(#24955982)
> I think you meant to write `type Id a = a`
Indeed I did, sorry, unfortunately too late to edit. The following reproduces the error:
{-# LANGUAGE TypeSynonymInstances #-}
type Id a = a
instance Monad Id where
x >>= f = f x
return = id
(The last two lines can be ommitted, since GHC aborts before checking the instance body. Edit: which is why I didn't notice I had the arguments to >>= backward; fixed?)
> It may be difficult to unify them via the type system. This is even more difficult for higher-order functions that take other functions.
IMO, the main difficulty in unifying `a ~ Monad m => m a` is inferring `m ~ \a1-> a1` in a way that allows `\a1-> a1` to inherit `Id`'s instances. It's a understandable deficiency, but it is a deficiency.
Indeed I did, sorry, unfortunately too late to edit. The following reproduces the error:
(The last two lines can be ommitted, since GHC aborts before checking the instance body. Edit: which is why I didn't notice I had the arguments to >>= backward; fixed?)> It may be difficult to unify them via the type system. This is even more difficult for higher-order functions that take other functions.
IMO, the main difficulty in unifying `a ~ Monad m => m a` is inferring `m ~ \a1-> a1` in a way that allows `\a1-> a1` to inherit `Id`'s instances. It's a understandable deficiency, but it is a deficiency.