Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code:
- ```
- class KeyStore s where [20:40]
- lookup :: s -> k -> Maybe v
- instance KeyStore (Map.Map k v) where
- lookup store key = Map.lookup key store
- ```
- Error:
- ```
- test/KeyStoreSpec.hs:7:37: error:
- • Couldn't match type ‘k1’ with ‘k’
- Expected: Map k1 v1
- Actual: Map k v
- ‘k1’ is a rigid type variable bound by
- the type signature for:
- KeyStore.lookup :: forall k1 v1. Map k v -> k1 -> Maybe v1
- at test/KeyStoreSpec.hs:7:3-8
- ‘k’ is a rigid type variable bound by
- the instance declaration
- at test/KeyStoreSpec.hs:6:10-31
- • In the second argument of ‘Map.lookup’, namely ‘store’
- In the expression: Map.lookup key store
- In an equation for ‘KeyStore.lookup’:
- KeyStore.lookup store key = Map.lookup key store
- • Relevant bindings include
- key :: k1 (bound at test/KeyStoreSpec.hs:7:16)
- store :: Map k v (bound at test/KeyStoreSpec.hs:7:10)
- lookup :: Map k v -> k1 -> Maybe v1
- (bound at test/KeyStoreSpec.hs:7:3)
- |
- 7 | lookup store key = Map.lookup key store
- | ^^^^^
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement