Restricted Data Types

Taral taralx at
Tue Feb 7 19:38:25 EST 2006

On 2/5/06, Jim Apple <jbapple+haskell-prime at> wrote:
> Have we considered Restricted Data Types?
> 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.

Taral <taralx at>
"Computer science is no more about computers than astronomy is about
    -- Edsger Dijkstra

More information about the Haskell-prime mailing list