On 2/8/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
It seems we can emulate the restricted data types in existing
Haskell.
I have proposed this for Haskell' libraries. See
http://hackage.haskell.org/trac/haskell-prime/ticket/98
Jim
___
On 2/5/06, Jim Apple [EMAIL PROTECTED] wrote:
Have we considered Restricted Data Types?
http://www.cs.chalmers.se/~rjmh/Papers/restricted-datatypes.ps
Nice to see my old paper hasn't sunk without trace!
As Taral pointed out, though, Restricted Data Types have not been implemented,
and
From: John Meacham [EMAIL PROTECTED]
Subject: Re: Restricted Data Types
however, what prevents the following from being _infered_
return Foo :: Moand m = m Foo
so, we think we can specialize it to
return Foo :: Set Foo
however, we no longer have the constraint that Foo must be in Eq!
Maybe
John Hughes wrote:
That means that the Monad class is not allowed to declare
return :: a - m a
because there's no guarantee that the type m a would be well-formed. The
type declared for return has to become
return :: wft (m a) = a - m a
I'm confused. It seems like the type (a - m a)
| Have we considered Restricted Data Types?
|
| http://www.cs.chalmers.se/~rjmh/Papers/restricted-datatypes.ps
|
|
| Finally, I wrote my paper before fundeps came on the scene. Some of
the contortions I went through
| in my simulation of RDTs could be avoided with the help of fundeps.
A key
Simon Peyton-Jones wrote:
Another reasonable alternative is
data Set a = Eq a = Set (List a)
The type of member would become
member :: a - Set a - Bool
(with no Eq constraint).
John Hughes mentions this in section 5.2 of the paper, and points out a
problem: a function like
John Meacham wrote:
however, (Set (a - a)) is malformed. since a _requirement_ is that Set
can only be applied to a type with an Eq constraint so the instance you
try to do something like
returnid :: Set (a - a) -- ^ static error! you need
returnid :: Eq (a - a) = Set (a - a)
the instant you
On Tue, Feb 07, 2006 at 07:59:46PM -0800, Ashley Yakeley wrote:
John Meacham wrote:
however, (Set (a - a)) is malformed. since a _requirement_ is that Set
can only be applied to a type with an Eq constraint so the instance you
try to do something like
returnid :: Set (a - a) -- ^ static
Jim Apple wrote:
Have we considered Restricted Data Types?
http://www.cs.chalmers.se/~rjmh/Papers/restricted-datatypes.ps
I'd never seen this paper before. This would be a really nice extension to
have. The dictionary wrangling looks nasty, but I think it would be easy to
implement it in