Haskell 趣學指南

Updated 2 years ago

maoxiaoke (@maoxiaoke) started discussion #33

7 months ago · 0 comments


注意下,Nothing 的类型为 Maybe a。它是多态的,若有函数取 Maybe Int 类型的参数,就一概可以传给它一个 Nothing,因为 Nothing 中不包含任何值。Maybe a 类型可以有 Maybe Int 的行为,正如 5 可以是 Int 也可以是 Double。与之相似,空 List 的类型是 [a],可以与一切 List 打交道。因此,我们可以 [1,2,3]++[],也可以 ["ha","ha,","ha"]++[]。

Build Our Own Type and Typeclass (Edit this file)


No description provided.

No comments on this discussion.

to join this conversation on GitBook. Already have an account? Sign in to comment

You’re not receiving notifications from this thread.

1 participant