Hi,

Am Donnerstag, den 03.12.2009, 13:03 -0500 schrieb David Menendez:
> On Thu, Dec 3, 2009 at 6:28 AM, Joachim Breitner
> <m...@joachim-breitner.de> wrote:
> > Am Donnerstag, den 03.12.2009, 11:13 +0000 schrieb Matthew Pocock:
> >> Perhaps what you are looking for is a more powerful "defining"
> >> semantics?
> >>
> >> newtype MyFoo = Foo defining (Foo(..)) -- all class instances that Foo
> >> has are delegated through from MyFoo
> >
> > it goes into the right direction, but I’d also like to have this also
> > capeable to derive single functions (giving them a new name), and not
> > only class instances.
> 
> Something like the restricted type synonym extension in Hugs?
> 
> <http://cvs.haskell.org/Hugs/pages/users_guide/restricted-synonyms.html>

yes, this is very close to what I’d hope for. Last minor (but really
minor) wish: I don’t think it would hurt to allow the use of this
feature independent of the definition of the newtype:

I could have a
newtype Foo = Foo Int
somewhere, possibly in a different module, and write something like

myFoo :: Foo -> (Foo,Foo) resolving Foo
myFoo a = (a,a+a)

(syntax and wording very ad hoc and not thought through).

But yes, I think I’d be happy to have hugs’ extension here at hand
sometimes.

Greetings,
Joachim

-- 
Joachim Breitner
  e-Mail: m...@joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  ICQ#: 74513189
  Jabber-ID: nome...@joachim-breitner.de

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to