specify type for a function in GHCi
9 Sep
2010
9 Sep
'10
4:32 p.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
4:35 p.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.
5589
Age (days ago)
5589
Last active (days ago)
2 comments
3 participants
participants (3)
-
Felipe Lessa -
Gaius Hammond -
Henry Olders