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: [email protected]
Homepage: http://www.joachim-breitner.de
ICQ#: 74513189
Jabber-ID: [email protected]
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
