以下代码段来自(https://stackoverflow.com/a/37461290/2129302):
tensor : Vect n Nat -> Type -> Type
tensor [] a = a
tensor (m :: ms) a = Vect m (tensor ms a)
我想定义以下内容:
mkStr : (Show a) => tensor shape a -> String
mkStr x = show x
但是这会产生以下错误:
Can't find implementation for Show (tensor shape a)
然而,在REPL上,我可以运行"显示[一些张量值...]"。为什么这样做以及我该怎么做才能解决它?