> I guess TH could probably do this. I think this does what you wish for: http://hackage.haskell.org/packages/archive/peakachu/0.2/doc/html/Data-Newtype.html
Example: > $(mkWithNewtypeFuncs [2] ''ZipList) > withZipList2 (<*>) [(+3), (*3)] [6, 7] [9, 21] > $(mkInNewtypeFuncs [2] ''ZipList) > getZipList $ inZipList2 (++) (ZipList "hello ") (ZipList "world") > "hello world" in some future this won't be in this unrelated "peakachu" package, and be incorporated into Neil M's derive. but for now this is where you can find it. cheers, Yair On Dec 3, 12:07 pm, Joachim Breitner <m...@joachim-breitner.de> 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 > > signature.asc > < 1KViewDownload > > _______________________________________________ > Haskell-Cafe mailing list > haskell-c...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe