[Haskell-beginners] specify type for a function in GHCi

Felipe Lessa felipe.lessa at gmail.com
Thu Sep 9 10:35:27 EDT 2010


On Thu, Sep 9, 2010 at 11:32 AM, Henry Olders <henry.olders at mcgill.ca> wrote:
> Is there a way to specify the type for a function inside GHCi, that is, without creating a separate file and loading it in?

Sure!

Prelude> let f x = x + 2
Prelude> :t f
f :: (Num a) => a -> a
Prelude> let g :: Int -> Int; g x = x + 2
Prelude> :t g
g :: Int -> Int

Cheers! =D

-- 
Felipe.


More information about the Beginners mailing list