[Haskell-cafe] RLE in Haskell: why does the type variable get instantiated?

Arthur van Leeuwen arthurvl at cs.uu.nl
Tue Jul 31 08:16:30 EDT 2007

On 31-jul-2007, at 11:38, Chris Eidhof wrote:

> Hey Haskell-Cafe,
> I was trying out the code in Dons's article [1], and I noticed a  
> weird thing when doing it in GHCi. When binding the function  
> composition to a variable, the type suddenly changes. I'm not  
> completely sure why this happens. Is this because GHCi is in a  
> monad and wants to find an instance for the type variable?

Yes, that is mostly correct. GHCi does defaulting of types, and in  
this case
the type variable defaults to Integer.

With regards, Arthur.


   /\    / |       arthurvl at cs.uu.nl       | Work like you don't need  
the money
/__\  /  | A friend is someone with whom | Love like you have never  
been hurt
/    \/__ | you can dare to be yourself   | Dance like there's nobody  

More information about the Haskell-Cafe mailing list