FP Laboratory 2

From Marek Běhálek Wiki
Revision as of 12:08, 12 September 2019 by Beh01 (talk | contribs)
Jump to navigation Jump to search

Types

  1. Using the GHCi command :info, learn the type of the following functions (and operators): +, sqrt, succ, max
  2. Using the command :set +t it is possible to get the information about the type of the evaluated expressions. With this setting on evaluate expressions:
    • 5 + 8 No comments
    • 3 * 5 + 8 No comments
    • 2 + 4 No comments
    • sqrt 16 No comments
    • succ 6 No comments
    • succ 7 No comments
    • pred 9 No comments
    • pred 8 No comments
    • sin (pi / 2) No comments
    • truncate pi No comments
    • round 3.5 No comments
    • round 3.4 No comments
    • floor 3.7 No comments
    • ceiling 3.3 No comments