-
-
Save tonymorris/6fcd16b4e3dc7b9abc071056a0417d4b 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
{-# LANGUAGE LambdaCase #-} | |
import Control.Lens | |
data Blah = | |
Blah1 Int | |
| Blah2 String | |
| Blah3 [()] | |
deriving (Eq, Show) | |
_Blah1or2 :: | |
Prism' Blah (Either Int String) | |
_Blah1or2 = | |
prism' | |
(either Blah1 Blah2) | |
(\case | |
Blah1 n -> Just (Left n) | |
Blah2 s -> Just (Right s) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment