[Haskell-cafe] Re: Re: Non-existing types in existential quantification?

Ben Franksen ben.franksen at online.de
Sun Oct 3 13:04:26 EDT 2010

Henning Thielemann wrote:
> On Sun, 3 Oct 2010, Ben Franksen wrote:
>> Christopher Done wrote:
>>> Consider the following program:
>>> main = putStrLn $ show $ length [undefined :: a,undefined :: b]
>>> A concrete type of the element in list doesn't need to be determined
>>> at runtime, or any time. a unifies with b, and that unifies with x in
>>> length :: [x] -> Int.
>> A simpler example is
>>  main = print Nothing
> This seems to be a different example, because "GHCi -Wall" says that the
> type variable defaults to (). Thus 'Nothing' has monomorphic type at
> runtime. The difference is certainly that 'print' requires a Show
> instance, whereas Christopher's example does not require a type
> constraint.

Right. I always forget about defaulting. This is an obscure feature of the

Are there any programs that rely on defaulting and could not be easily
re-written so as not to?


More information about the Haskell-Cafe mailing list