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

Brian Hulley brianh at metamilk.com
Tue Aug 22 10:52:01 EDT 2006

Brian Hulley wrote:
> Bulat Ziganshin wrote:
>>>> f :: Num a => a -> Int
>>>> write as
>>>> f :: Num -> Int

Actually separating the class namespace from the tycon namespace would allow 
you to get a very similar effect to the use of abstract interfaces in C++ 

    class Object a where
        name :: a -> Unique

    -- generated automatically?
    data Object = forall a. Object a

    -- general version
    foo :: Object a => a -> Unique

    -- to use with the standard Object wrapper
    foo :: Object -> Unique

Regards, Brian.
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.


More information about the Haskell-Cafe mailing list