"class []" proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Aug 22 08:22:50 EDT 2006


Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:

> 2) allow to use type classes in type declarations like the types
> itself. for example, allow the following:
> 
> f :: Num a => a -> Int
> write as
> f :: Num -> Int
> 
> and following:
> 
> sequence :: Monad m => [m a] -> m [a]
> write as
> sequence :: [Monad a] -> Monad [a]

How would you distinguish the class contexts of (for instance)
    sequenceLift :: (Monad m, Monad r) => [m a] -> r [a]
if it were to be written instead as simply
    sequenceLift :: [Monad a] -> Monad [a]

And how would one add multiple class constraints to a single type
variable, for instance in:
    f :: (Functor m, Monad m) => (a->b) -> m [a] -> m b

?

Regards,
    Malcolm


More information about the Haskell-Cafe mailing list