Type inference interferes with referential transparency

前端 未结 7 1303
醉酒成梦
醉酒成梦 2021-02-12 18:07

What is the precise promise/guarantee the Haskell language provides with respect to referential transparency? At least the Haskell report does not mention this notion.

C

7条回答
  •  被撕碎了的回忆
    2021-02-12 18:21

    A another type has been chosen, because !! requires an Int. The full computation now uses Int instead of Integer.

    λ> ( (7^7^7`mod`5`mod`2 :: Int)==1, [False,True]!!(7^7^7`mod`5`mod`2) )
    (False,False)
    

提交回复
热议问题