使用镜头选择元组的字段(Haskell)

时间:2014-12-30 13:17:56

标签: haskell lenses

以下不起作用,我该如何解决?

Prelude Control.Lens> (2, 3, 4) ^. alongside _1 _2

<interactive>:19:14:
    Couldn't match type ‘(s0, s'0)’ with ‘(t0, t1, t2)’
    Expected type: Getting (a, a') (t0, t1, t2) (a, a')
      Actual type: LensLike
                     (Const (a, a')) (s0, s'0) (t3, t'0) (a, a') (a, a')
    In the second argument of ‘(^.)’, namely ‘alongside _1 _2’
    In the expression: (2, 3, 4) ^. alongside _1 _2

我想要的是(2, 3)

0 个答案:

没有答案