Created
February 14, 2014 21:31
-
-
Save techtangents/9009745 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
import Data.Semigroup | |
import Data.List.NonEmpty | |
isA :: a -> Bool | |
isA = undefined | |
isB :: a -> Bool | |
isB = undefined | |
isC :: a -> Bool | |
isC = undefined | |
newtype OrBool = OrBool Bool | |
toBool (OrBool a) = a | |
instance Semigroup OrBool where | |
(OrBool a) <> (OrBool b) = OrBool (a || b) | |
orr :: NonEmpty (a -> Bool) -> a -> Bool | |
orr = (fmap toBool) . ((orr' . ((fmap . fmap) OrBool))) | |
orr' :: NonEmpty (a -> OrBool) -> a -> OrBool | |
orr' = sconcat | |
f :: a -> Bool | |
f = orr $ isA :| [isB, isC] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment