-
-
Save theqp/bf5061b6e9202b70a97133888e770550 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
class Fold a where | |
fold :: a | |
instance Fold (b -> (a -> b) -> Maybe a -> b) where | |
fold nothing just = \case | |
Nothing -> nothing | |
Just a -> just a | |
instance Fold ((a -> c) -> (b -> c) -> Either a b -> c) where | |
fold l r = \case | |
Left a -> l a | |
Right b -> r b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment