Difference between revisions of "FP Laboratory 2"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
#Using the GHCi command <code>:info</code>, learn the type of the following functions (and operators): <code>+, sqrt, succ, max</code> | #Using the GHCi command <code>:info</code>, learn the type of the following functions (and operators): <code>+, sqrt, succ, max</code> | ||
− | # | + | #Get the information about the data type of following expressions and evaluate them. it is possible using the command <code>:type</code>. You can switch this option on for all commands by <code>:set +t</code> (removing by <code>:unset +t</code>). |
<syntaxhighlight lang="Haskell" > | <syntaxhighlight lang="Haskell" > | ||
5 + 8 | 5 + 8 |
Revision as of 12:15, 12 September 2019
Types
- Using the GHCi command
:info
, learn the type of the following functions (and operators):+, sqrt, succ, max
- Get the information about the data type of following expressions and evaluate them. it is possible using the command
:type
. You can switch this option on for all commands by:set +t
(removing by:unset +t
).
5 + 8
3 * 5 + 8
2 + 4
sqrt 16
succ 6
succ 7
pred 9
pred 8
sin (pi / 2)
truncate pi
round 3.5
round 3.4
floor 3.7
ceiling 3.3