【发布时间】:2016-08-24 21:01:28
【问题描述】:
我在 psci repl 中执行此操作。这是我的功能:
$> import Data.List
$> let f (x:xs) = x
$> let f Nil = Nil
$> let a = 1:2:3:Nil
$> f a
我收到此错误:
Could not match type
Int
with type
List t0
while trying to match type List Int
with type List (List t0)
while checking that expression a
has type List (List t0)
in value declaration it
where t0 is an unknown type
我知道这是因为我的函数 f 没有返回 List Int 的签名。但是如何在 repl 中声明一个呢?
【问题讨论】:
标签: purescript