Hmm, as long as you provide a type signature, Haskell could do implicit wrapping as well.
If I'm not mistaken, the compiler should be able to figure out what to do in this case: > myfoo :: (Blubb -> MyFoo) -> MyFoo -> MyFoo -> MyFoo > myfoo = foo Sjoerd On Dec 3, 2009, at 11:07 AM, Joachim Breitner wrote: > Hi, > > Am Donnerstag, den 03.12.2009, 01:16 +0100 schrieb Martijn van > Steenbergen: >> So here's a totally wild idea Sjoerd and I came up with. >> >> What if newtypes were unwrapped implicitly? >> >> What advantages and disadvantages would it have? >> In what cases would this lead to ambiguous code? > > not sure if this is what you are thinking at, but everytime I wrap a > type Foo in a newtype MyFoo to define my own instances (or just for more > expressiveness code), I wish I had a way to tell the compiler: > „Please define function myfoo to be the same as foo, with all occurences > of Foo in its type signature replaced by MyFoo.“ > > Instead I find my self writing manually code like > > myfoo :: (Blubb -> MyFoo) -> MyFoo -> MyFoo -> MyFoo > myfoo f (MyFoo a) (MyFoo b) = MyFoo (foo (unMyFoo . f) a b) > > I guess TH could probably do this. > > Greetings, > Joachim > > > -- > Joachim "nomeata" Breitner > mail: m...@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C > JID: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ > Debian Developer: nome...@debian.org > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Sjoerd Visscher sjo...@w3future.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe