Haskell-newbie报告.问题如下:在Haskell中,我们有fst并且snd返回2元组的第一个和第二个元素.为什么我们没有一个简单的方法从任何元组访问第i个元素?现在我有一个3元组,我想读第一个元素,完成这个任务的唯一方法是进行模式匹配技巧.为什么不能这样做容易?或者也许有一些简单的方法?
为什么我不能在Haskell中构造大元组?为什么有元组大小限制?
Prelude> (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
<interactive>:1:0:
No instance for (Show
(t,
t1,
t2,
...
t23))
arising from a use of `print' at <interactive>:1:0-48
Possible fix:
add an instance declaration for
(Show
(t,
t1,
t2,
...
t23))
In a stmt of a 'do' expression: print it
Run Code Online (Sandbox Code Playgroud)