11 Jan
2005
11 Jan
'05
5:50 a.m.
Ashley Yakeley wrote:
Amr A Sabry <sabry@cs.indiana.edu> wrote:
Because of the additional type constraint (FinSet a =>) we cannot make the type Vec an instance of the class Monad, and hence we cannot use the do-notation to express our computations.
You can to do this with GADTs:
data MyVec a where MkMyVec :: (FinSet a) => Vec a -> MyVec a
instance Monad MyVec where return a = MkMyVec (vreturn a) etc.
Bug #1097046 aside, I don't see how this can possibly work. There's nothing to prevent return from being passed an argument for which there's no FinSet instance. -- Ben