Major type-class overhaul

Ashley Yakeley ashley at semantic.org
Wed Nov 15 20:52:05 EST 2006


Simon Peyton-Jones wrote:

> 3. Dictionaries are packaged in data constructors

> This feature has been often requested, becuase it allows you to
> package a dictionary into an ordinary (non-existential) data type, and
> be able to use it.

Indeed, one can now simply reify class instances:

   data NumInst a where
     MkNumInst :: Num a => NumInst a

   intInst :: NumInst Int
   intInst = MkNumInst

   plus :: NumInst a -> a -> a -> a
   plus MkNumInst p q = p + q

Expect a whole new batch of type shenanigans from Oleg.

-- 
Ashley Yakeley
Seattle, WA



More information about the Glasgow-haskell-users mailing list