print function displays value of any
printable type to the standard output device. print function do this by calling
show on its input first.
Technically print is defined like below.
print x = putStrLn (show x)
*Main> :t print print :: Show a => a -> IO ()
Observe the signature of print function,
it takes an argument ‘a’ which type should be instance of type class Show and
return to IO.
*Main> print 10 10 *Main> *Main> print [1, 2, 3] [1,2,3] *Main> *Main> print 10.01 10.01 *Main>
No comments:
Post a Comment