SHARE

TWEET

# Untitled

a guest
Apr 21st, 2019
99
Never

**Not a member of Pastebin yet?**

**, it unlocks many cool features!**

__Sign Up__- diff :: [(a,b)] -> [c]
- diff [] = []
- diff ((a,b):xs) = (a-b):(diff xs)
- GHCI ERROR MESSAGES:
- addprime.hs:3:19: error:
- • Couldn't match type ‘a’ with ‘c’
- ‘a’ is a rigid type variable bound by
- the type signature for:
- diff :: forall a b c. [(a, b)] -> [c]
- at addprime.hs:1:1-22
- ‘c’ is a rigid type variable bound by
- the type signature for:
- diff :: forall a b c. [(a, b)] -> [c]
- at addprime.hs:1:1-22
- Expected type: [c]
- Actual type: [a]
- • In the expression: (a - b) : (diff xs)
- In an equation for ‘diff’: diff ((a, b) : xs) = (a - b) : (diff xs)
- • Relevant bindings include
- xs :: [(a, b)] (bound at addprime.hs:3:13)
- a :: a (bound at addprime.hs:3:8)
- diff :: [(a, b)] -> [c] (bound at addprime.hs:2:1)
- |
- 3 | diff ((a,b):xs) = (a-b):(diff xs)
- | ^^^^^^^^^^^^^^^
- addprime.hs:3:22: error:
- • Couldn't match expected type ‘a’ with actual type ‘b’
- ‘b’ is a rigid type variable bound by
- the type signature for:
- diff :: forall a b c. [(a, b)] -> [c]
- at addprime.hs:1:1-22
- ‘a’ is a rigid type variable bound by
- the type signature for:
- diff :: forall a b c. [(a, b)] -> [c]
- at addprime.hs:1:1-22
- • In the second argument of ‘(-)’, namely ‘b’
- In the first argument of ‘(:)’, namely ‘(a - b)’
- In the expression: (a - b) : (diff xs)
- • Relevant bindings include
- xs :: [(a, b)] (bound at addprime.hs:3:13)
- b :: b (bound at addprime.hs:3:10)
- a :: a (bound at addprime.hs:3:8)
- diff :: [(a, b)] -> [c] (bound at addprime.hs:2:1)
- |
- 3 | diff ((a,b):xs) = (a-b):(diff xs)
- | ^
- Failed, no modules loaded.

RAW Paste Data

We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.