2013-03-28 4 views
2

어떻게 하스켈에서 16- 튜플을 만들 수 없으며,이 오류는 무엇을 의미합니까?하스켈에서 16- 튜플을 만들려고 할 때 이상한 오류가 발생했습니다.

GHCi, version 7.6.2: http://www.haskell.org/ghc/ :? for help 
Loading package ghc-prim ... linking ... done. 
Loading package integer-gmp ... linking ... done. 
Loading package base ... linking ... done. 
Prelude> (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) 

<interactive>:2:1: 
    No instance for (Show 
         (t0, 
         t1, 
         t2, 
         t3, 
         t4, 
         t5, 
         t6, 
         t7, 
         t8, 
         t9, 
         t10, 
         t11, 
         t12, 
         t13, 
         t14, 
         t15)) 
     arising from a use of `print' 
    Possible fix: 
     add an instance declaration for 
     (Show 
     (t0, 
      t1, 
      t2, 
      t3, 
      t4, 
      t5, 
      t6, 
      t7, 
      t8, 
      t9, 
      t10, 
      t11, 
      t12, 
      t13, 
      t14, 
      t15)) 
    In a stmt of an interactive GHCi command: print it 

<interactive>:2:2: 
    No instance for (Num t0) arising from the literal `1' 
    The type variable `t0' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 1 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:4: 
    No instance for (Num t1) arising from the literal `2' 
    The type variable `t1' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 2 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:6: 
    No instance for (Num t2) arising from the literal `3' 
    The type variable `t2' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 3 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:8: 
    No instance for (Num t3) arising from the literal `4' 
    The type variable `t3' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 4 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:10: 
    No instance for (Num t4) arising from the literal `5' 
    The type variable `t4' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 5 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:12: 
    No instance for (Num t5) arising from the literal `6' 
    The type variable `t5' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 6 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:14: 
    No instance for (Num t6) arising from the literal `7' 
    The type variable `t6' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 7 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:16: 
    No instance for (Num t7) arising from the literal `8' 
    The type variable `t7' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 8 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:18: 
    No instance for (Num t8) arising from the literal `9' 
    The type variable `t8' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 9 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:20: 
    No instance for (Num t9) arising from the literal `10' 
    The type variable `t9' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 10 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:23: 
    No instance for (Num t10) arising from the literal `11' 
    The type variable `t10' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 11 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:26: 
    No instance for (Num t11) arising from the literal `12' 
    The type variable `t11' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 12 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:29: 
    No instance for (Num t12) arising from the literal `13' 
    The type variable `t12' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 13 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:32: 
    No instance for (Num t13) arising from the literal `14' 
    The type variable `t13' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 14 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:35: 
    No instance for (Num t14) arising from the literal `15' 
    The type variable `t14' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 15 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 

<interactive>:2:38: 
    No instance for (Num t15) arising from the literal `16' 
    The type variable `t15' is ambiguous 
    Possible fix: add a type signature that fixes these type variable(s) 
    Note: there are several potential instances: 
     instance Num Double -- Defined in `GHC.Float' 
     instance Num Float -- Defined in `GHC.Float' 
     instance Integral a => Num (GHC.Real.Ratio a) 
     -- Defined in `GHC.Real' 
     ...plus three others 
    In the expression: 16 
    In the expression: 
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
    In an equation for `it': 
     it = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 
Prelude> 
+0

비슷한 질문이 있습니다. http://stackoverflow.com/questions/15559234/working-with-list-of-tuples-in-haskell/15559825 – kputnam

+0

중복 된 http://stackoverflow.com/q/2978389/ 676939 – Alexandros

+0

@Alexandros : 이것은 중복되지 않습니다. 16 개의 오류가 무엇을 의미하는지 물어보고 있는데, 여기서 "대답"은 대답하지 않았습니다. – Dog

답변

13

기본 libary은 매우 큰 튜플을 사용하는 것은 좋지 않습니다 일반적으로 크기 15까지 만 튜플 쇼 인스턴스를 포함하고 있습니다.

+0

좋아요,하지만 질문의 후반 부분에는 답이 없습니다. – Dog

+2

1) Haskell에서 16 개의 튜플을 만들 수 있습니다. (방금 했었습니다.) 2) 오류는 16 튜플을 Prelude의 문자열로 변환하는 루틴이 없다는 것을 의미합니다.하지만 자신 만의 인스턴스보기를 만들 수 있습니다. 이라고 밝혔다. –

+0

@ ThomasM.DuBuisson 그런데 왜 그 뒤에 16 개의 오류가 더 있습니까? – Dog

관련 문제