Restricted Data Types
John Meacham
john at repetae.net
Tue Feb 7 19:43:37 EST 2006
On Tue, Feb 07, 2006 at 06:38:25PM -0600, Taral wrote:
> On 2/5/06, Jim Apple <jbapple+haskell-prime at gmail.com> wrote:
> > Have we considered Restricted Data Types?
> >
> > http://www.cs.chalmers.se/~rjmh/Papers/restricted-datatypes.ps
> >
> > Or even absracting over contexts, as described in section 7.5 (p.
> > 14/15) of the above?
>
> I've discovered an extra problem with RDT: Context can "appear" from nowhere:
>
> In module Heap:
> data Ord a => Heap a = ...
>
> In another module:
> sort :: [a] -> [a]
> sort = <some code using Heap>
>
> You wanted to mask the constraint, but it will leak into the type
> signature of "sort", and there's nothing you can do about it, short of
> some kind of context alias.
But this is exactly the behavior you want, you can't very well expect to
sort without an Ord a instance.
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Haskell-prime
mailing list