Created
February 4, 2020 21:18
-
-
Save patrl/2dd02b1d2bda4a017cc278568baa507a 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
newtype ContBool a = ContBool { (>-) :: (a -> Bool) -> Bool } | |
instance Functor ContBool where | |
fmap f m = ContBool $ \k -> | |
m >- | |
\a -> | |
k $ f a | |
instance Applicative ContBool where | |
pure a = ContBool $ \k -> k a | |
m <*> n = ContBool $ \k -> | |
m >- | |
\f -> | |
n >- | |
\x -> k $ f x | |
class (Monad' f) where | |
return' :: a -> f a | |
join' :: f (f a) -> f a | |
instance Monad' ContBool where | |
return' = pure | |
join' m' = ContBool $ \k -> | |
m' >- | |
\m -> m >- k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment