Haskell笔记 (7)—— 类型

(1)

Haskell requires type names to start with an uppercase letter, and variable names must start with a lowercase letter.

举例如下:

> let C = "foo"

<interactive>:20:5: Not in scope: data constructor ‘C’
> let c = "foo"
> c
"foo"
> :type c
c :: [Char]

(2)

The combination of :: and the type after it is called a type signature.

举例如下:

> :type 'a'
'a' :: Char

:: Char就被称之为type signature

 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理