0
文字列の2D行列を入力として受け取り、文字列の2D行列を出力として返すHaskell関数をどのように定義できますか?これは私の推測Haskell 2D行列の文字列
empty2o :: [[String], [String]] -> [[String], [String]]
である。しかし、これは私にこのエラーが発生します
code.hs:17:12: error:
Illegal type: `[[String], [String]]'
Perhaps you intended to use DataKinds
|
17 | empty2o :: [[String], [String]] -> [[String], [String]]
| ^^^^^^^^^^^^^^^^^^^^
code.hs:17:36: error:
Illegal type: `[[String], [String]]'
Perhaps you intended to use DataKinds
|
17 | empty2o :: [[String], [String]] -> [[String], [String]]
| ^^^^^^^^^^^^^^^^^^^^
2次元行列は、[[String]、[String]]ではなく、[[String]] 'です。なぜあなたはそれをそのように定義すべきだと思いますか? –
良い答えは別として、リストにデータ型のような行列を実装することは明るい考えではありません。この目的のために既に['Data.Matrix'](https://hackage.haskell.org/package/matrix-0.3.5.0/docs/Data-Matrix.html)があります。 – Redu