Created
October 15, 2015 12:16
-
-
Save supermario/5c54e07bf461c280794b to your computer and use it in GitHub Desktop.
lens + maybe
This file contains hidden or 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
data Box = Box { _value :: Integer } | |
data World = World { _box :: Maybe Box } | |
makeLenses ''Box | |
makeLenses ''World | |
steps :: StateT World IO () | |
steps = do | |
box.value %= succ | |
-- Couldn't match type ‘Box’ with ‘Maybe Box’ | |
-- Expected type: (Integer -> f Integer) | |
-- -> Maybe Box -> f (Maybe Box) | |
-- Actual type: (Integer -> f Integer) -> Box -> f Box | |
-- In the second argument of ‘(.)’, namely ‘pose’ | |
-- In the expression: robot . pose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment