Last active
January 29, 2017 02:40
-
-
Save Wizek/0b51ad8413bdcfe24c600e1907324ade to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.HashMap as HM | |
hmAt :: (Functor f, Ord t, Hashable t) => t -> (Maybe a -> f b) -> HM.Map t a -> f t1 | |
hmAt k = lens g s | |
where | |
s v = HM.insert k v | |
g = HM.lookup k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/Test/Hspec.hs:75: | |
2) ! eff | |
uncaught exception: TypeError (/path/to/spec/Spec.hs:1353:10: error: | |
• Couldn't match type ‘b’ with ‘HM.Map t a0’ | |
‘b’ is a rigid type variable bound by | |
the type signature for: | |
hmAt :: forall (f :: * -> *) t a b t1. | |
(Functor f, Ord t, Hashable t) => | |
t -> (Maybe a -> f b) -> HM.Map t a -> f t1 | |
at /path/to/spec/Spec.hs:1352:9 | |
Expected type: (Maybe a -> f b) -> HM.Map t a -> f t1 | |
Actual type: (Maybe a -> f (HM.Map t a0)) | |
-> HM.Map t a -> f (HM.Map t a0) | |
• In the expression: lens g s | |
In an equation for ‘hmAt’: | |
hmAt k | |
= lens g s | |
where | |
s (Just v) = HM.insert k v | |
g = HM.lookup k | |
• Relevant bindings include | |
s :: forall a. Maybe a -> HM.Map t a -> HM.Map t a | |
(bound at /path/to/spec/Spec.hs:1355:3) | |
g :: forall a. HM.Map t a -> Maybe a | |
(bound at /path/to/spec/Spec.hs:1356:3) | |
k :: t | |
(bound at /path/to/spec/Spec.hs:1353:6) | |
hmAt :: t -> (Maybe a -> f b) -> HM.Map t a -> f t1 | |
(bound at /path/to/spec/Spec.hs:1353:1) | |
(deferred type error)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment