Prelude> :t 1.0
1.0 :: Fractional a => a
You can specify the type with a type annotation. The only requirement is that the type must have a Fractional
instance.
Prelude> 1.0 :: Double
1.0
it :: Double
Prelude> 1.0 :: Data.Ratio.Ratio Int
1 % 1
it :: GHC.Real.Ratio Int
if not the compiler will complain
Prelude> 1.0 :: Int
<interactive>:
No instance for (Fractional Int) arising from the literal `1.0'
In the expression: 1.0 :: Int
In an equation for `it': it = 1.0 :: Int