Skip to content

Instantly share code, notes, and snippets.

@techtangents
Created February 14, 2014 21:31
Show Gist options
  • Save techtangents/9009745 to your computer and use it in GitHub Desktop.
Save techtangents/9009745 to your computer and use it in GitHub Desktop.
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