
Hi, Am Donnerstag, den 03.12.2009, 11:25 +0100 schrieb Sjoerd Visscher:
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
Maybe it should, but it does not: $ cat test.hs data Foo = Foo newtype MyFoo = MyFoo { unMyFoo :: Foo } foo :: Foo -> (() -> Foo) -> Foo foo Foo f = Foo myfoo :: MyFoo -> (() -> MyFoo) -> MyFoo myfoo = foo $ runhaskell test.hs test.hs:9:8: Couldn't match expected type `MyFoo' against inferred type `Foo' In the expression: foo In the definition of `myfoo': myfoo = foo Greetings, JOachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de ICQ#: 74513189 Jabber-ID: nomeata@joachim-breitner.de