Created
August 13, 2017 22:21
-
-
Save LightAndLight/e63e23f31d01a368cb1563bfcaf04a16 to your computer and use it in GitHub Desktop.
Prisms?
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
_1st :: Prism' a a' -> Prism' (a, b, c) (a', b, c) | |
_1st p = prism' (\(a', b, c) -> (p # a', b, c)) (\(a, b, c) -> (,,) <$> a ^? p <*> pure b <*> pure c) | |
_2nd :: Prism' b b' -> Prism' (a, b, c) (a, b', c) | |
_2nd p = prism' (\(a, b', c) -> (a, p # b', c)) (\(a, b, c) -> (,,) a <$> b ^? p <*> pure c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment