相关疑难解决方法(0)

什么是XNoMonomorphismRestriction?

本页用法

$ ghci -XNoMonomorphismRestriction

启动haskell解释器.

XNoMonomorphismRestriction切换是什么意思?

haskell monomorphism-restriction

15
推荐指数
1
解决办法
1178
查看次数

为什么签名在分配后会发生变化

ghci我身边玩耍时得到以下表达式:unlines . map (\(a,b) -> show a ++ " " ++ show b)

现在,当我检查它时,:t我得到:

> :t  unlines . map (\(a,b) -> show a ++ " " ++ show b)
unlines . map (\(a,b) -> show a ++ " " ++ show b)
  :: (Show a, Show a1) => [(a, a1)] -> String
Run Code Online (Sandbox Code Playgroud)

完全如预期的那样.但现在,如果我尝试将其分配给某个名称,我会获得比原始名称更具体的签名:

> let f = unlines . map (\(a,b) -> show a ++ " " ++ show b)
> :t f
f :: …
Run Code Online (Sandbox Code Playgroud)

haskell ghci

7
推荐指数
1
解决办法
122
查看次数

标签 统计

haskell ×2

ghci ×1

monomorphism-restriction ×1