Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. {-# LANGUAGE MultiParamTypeClasses #-}
  2.  
  3. class F a b where
  4. f :: a -> b
  5.  
  6. class O a where
  7. o :: a
  8.  
  9. data K = K
  10. data L = L
  11. data M = M
  12.  
  13. instance O K where
  14. o = K
  15.  
  16. instance O L where
  17. o = L
  18.  
  19. instance F K L where
  20. f K = L
  21.  
  22. instance F L K where
  23. f L = K
  24.  
  25. instance F L L where
  26. f L = L
  27.  
  28. instance F M K where
  29. f M = K
  30.  
  31. F K L
  32. F L K
  33. F L L
  34. F M K
  35.  
  36. O K
  37. O L
  38.  
  39. f o :: K
  40.  
  41. *Main> f o :: K
  42.  
  43. <interactive>:2:1:
  44. No instance for (F a0 K) arising from a use of `f'
  45. The type variable `a0' is ambiguous
  46. Possible fix: add a type signature that fixes these type variable(s)
  47. Note: there are several potential instances:
  48. instance F M K -- Defined at hw.hs:28:10
  49. instance F L K -- Defined at hw.hs:22:10
  50. Possible fix: add an instance declaration for (F a0 K)
  51. In the expression: f o :: K
  52. In an equation for `it': it = f o :: K
  53.  
  54. <interactive>:2:3:
  55. No instance for (O a0) arising from a use of `o'
  56. The type variable `a0' is ambiguous
  57. Possible fix: add a type signature that fixes these type variable(s)
  58. Note: there are several potential instances:
  59. instance O L -- Defined at hw.hs:16:10
  60. instance O K -- Defined at hw.hs:13:10
  61. In the first argument of `f', namely `o'
  62. In the expression: f o :: K
  63. In an equation for `it': it = f o :: K
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement