OK, so since noone liked my original example here's another one.
It involves no defaulting and no classes in the funny function definition.
-- Here's the type signature that makes a difference.
--fun :: a -> Char
fun x = const (fun x) (fun True)
fix f = let x = f x in x
class C a where
m :: a -> String
instance C Char where
m _ = "has signature"
instance C Bool where
m _ = "no signature"
main = putStrLn (m (fix fun))
It is not at all surprising that you can write this. Originally
type signatures only allowed you to put a signature that was
more specific.
Polymorhic recursion on the other hand allows you to make the
type more general by putting a type signature on a definition.
Combining these you can make the signature be incomparable to
the deduced type. Using the class system you can then dispatch
on the type and get different behaviour.
-- Lennart
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
- RE: Implict parameters and monomorphism John Hughes
- RE: Implict parameters and monomorphism Simon Peyton-Jones
- Re: Implict parameters and monomorphism Lennart Augustsson
- Re: Implict parameters and monomorphism Marcin 'Qrczak' Kowalczyk
- Re: Implict parameters and monomorphism Lennart Augustsson
- Re: Implict parameters and monomorphism Andreas Rossberg
- Re: Implict parameters and monomorphism C.Reinke
- Re: Implict parameters and monomorphism Marcin 'Qrczak' Kowalczyk
- Re: Implict parameters and monomorphism C.Reinke
- Re: Implict parameters and monomorphism Lennart Augustsson
- Re: Implict parameters and monomorphism Marcin 'Qrczak' Kowalczyk
- RE: Implict parameters and monomorphism Alastair Reid
- Re: Implict parameters and monomorphism Marcin 'Qrczak' Kowalczyk
- Re: Implict parameters and monomorphism John Launchbury
- Re: Implict parameters and monomorphism John Hughes
- Re: Implict parameters and monomorphism Marcin 'Qrczak' Kowalczyk
- RE: Implict parameters and monomorphism Simon Peyton-Jones
- Re: Implict parameters and monomorphism Mieszko Lis
- Re: Implict parameters and monomorphism John Meacham
- Re: Implict parameters and monomorphism Marcin 'Qrczak' Kowalczyk
