有没有办法让GHC提供类型孔的类型类约束?

Wiz*_*zek 102 haskell types ghc

目前的行为

Prelude> show _

<interactive>:7:6:
    Found hole ‘_’ with type: a0
    Where: ‘a0’ is an ambiguous type variable
    Relevant bindings include it :: String (bound at <interactive>:7:1)
    In the first argument of ‘show’, namely ‘_’
    In the expression: show _
    In an equation for ‘it’: it = show _
Run Code Online (Sandbox Code Playgroud)

期望的行为

如果GHC还告诉我输入的孔具有Show类型类约束,那将是很好的.

杂项

GHC版本7.8.1

小智 1

目前还不可能。但根据猜测,它可能会被添加到 GHC 中。