specify type for a function in GHCi

9 Sep
2010
9 Sep
'10
10:32 a.m.
Is there a way to specify the type for a function inside GHCi, that is, without creating a separate file and loading it in? Henry

9 Sep
9 Sep
10:35 a.m.
On Thu, Sep 9, 2010 at 11:32 AM, Henry Olders
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.
5367
Age (days ago)
5367
Last active (days ago)
2 comments
3 participants
participants (3)
-
Felipe Lessa
-
Gaius Hammond
-
Henry Olders