[Haskell-cafe] hugs type inference

Ross Paterson ross at soi.city.ac.uk
Thu Oct 27 19:14:56 EDT 2005


On Thu, Oct 27, 2005 at 11:02:48PM +0200, Christian Maeder wrote:
> Hugs.Base> :t toRational 1 / 2
> toRational 1 / 2 :: Real a => Ratio Integer
> 
> ghci yields:
> Prelude> :t toRational 1 / 2
> 
> <interactive>:1:0:
>     Warning: Defaulting the following constraint(s) to type `Integer'
>              `Real a' arising from use of `toRational' at 
> <interactive>:1:0-9
>              In the first argument of `(/)', namely `toRational 1'
> toRational 1 / 2 :: Rational

They're both telling you the same thing:

	1 :: Num a => a
	toRational 1 :: Real a => Rational
	toRational 1 / 2 :: Real a => Rational

GHCi shows the type after defaulting; Hugs shows the type before, but
this can be changed with the +T option.



More information about the Haskell-Cafe mailing list