[Haskell] Re: Rebindable syntax for monads and arrows

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Tue Jan 11 00:50:32 EST 2005


Ashley Yakeley wrote:
 >Amr A Sabry <sabry at 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



More information about the Haskell mailing list