Advertisement
Guest User

Untitled

a guest
Feb 13th, 2023
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. Code:
  2.  
  3. ```
  4. class KeyStore s where [20:40]
  5. lookup :: s -> k -> Maybe v
  6.  
  7. instance KeyStore (Map.Map k v) where
  8. lookup store key = Map.lookup key store
  9. ```
  10.  
  11. Error:
  12. ```
  13. test/KeyStoreSpec.hs:7:37: error:
  14. • Couldn't match type ‘k1’ with ‘k’
  15. Expected: Map k1 v1
  16. Actual: Map k v
  17. ‘k1’ is a rigid type variable bound by
  18. the type signature for:
  19. KeyStore.lookup :: forall k1 v1. Map k v -> k1 -> Maybe v1
  20. at test/KeyStoreSpec.hs:7:3-8
  21. ‘k’ is a rigid type variable bound by
  22. the instance declaration
  23. at test/KeyStoreSpec.hs:6:10-31
  24. • In the second argument of ‘Map.lookup’, namely ‘store’
  25. In the expression: Map.lookup key store
  26. In an equation for ‘KeyStore.lookup’:
  27. KeyStore.lookup store key = Map.lookup key store
  28. • Relevant bindings include
  29. key :: k1 (bound at test/KeyStoreSpec.hs:7:16)
  30. store :: Map k v (bound at test/KeyStoreSpec.hs:7:10)
  31. lookup :: Map k v -> k1 -> Maybe v1
  32. (bound at test/KeyStoreSpec.hs:7:3)
  33. |
  34. 7 | lookup store key = Map.lookup key store
  35. | ^^^^^
  36. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement