Restricted Data Types

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


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.

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


More information about the Haskell-prime mailing list