Suppose I set the type
data A a = A a | B deriving Show
I know that (B :: A Int) == (B :: A Double)does not check typecheck, because A Intand A Doubleare different, unequal types, so I can not use(==) :: Eq a => a -> a -> Bool
But then I can ask ghci what it is show B, and ghci says that it is the string "B". What is a type B? Is it A Int? What for? And why ghci does not complain that the type is Bambiguous, given that it can be A afor absolutely anyone a.
I can also ask ghci what is show (B==B)it and it says "True" what is type B?
When I specify ghci type B with :t B, it prints B :: A a, but if I'm not confused in the two examples above, it should be a specific type without any type parameters. So, how do I know what is Bin B==B?
I'm a little confused. Is it being described somewhere?
source
share