Created
October 27, 2018 18:55
-
-
Save ddellacosta/85ddab8a506fa3eeddbc7b1c79877e8b to your computer and use it in GitHub Desktop.
Bool + Product type with associativity?
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
data Find a = NotFound a | Found a | |
deriving (Eq, Show) | |
instance (Semigroup a) => Semigroup (Find a) where | |
NotFound a <> NotFound b = NotFound (a <> b) | |
NotFound a <> Found b = Found (a <> b) | |
Found a <> NotFound b = Found (a <> b) | |
Found a <> Found b = Found (a <> b) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment