http://hackage.haskell.org/package/one-liner-0.5
Of particular note is that Divisible and Decidable are fairly new to the Contravariant library and have already found use. Very cool.
http://hackage.haskell.org/package/contravariant-1.2/docs/Data-Functor-Contravariant-Divisible.html
“A Divisible contravariant functor is the contravariant analogue of Applicative.”
Decidable, which is what the author uses in the library, is a contravariant Alternative.
For any not familiar:
covariant functor: fmap :: (a -> b) -> f a -> f b covariant applicative: (<*>) :: f (a -> b) -> f a -> f b
Alternative is a monoid on applicative functors. It adds an identity ‘f a’, and an associative binary operation:
(<|>) :: f a -> f a -> f a
contravariant functor: contramap :: (a -> b) -> f b -> f a contravariant applicative: divide :: (a -> (b, c)) -> f b -> f c -> f a
contravariant alternative: lose :: (a -> Void) -> f a choose :: (a -> Either b c) -> f b -> f c -> f a
Author is using lose and choose in their library. See if you can suss out what they’re doing from those applications. :)
Very cute!
http://hackage.haskell.org/package/one-liner-0.5
Of particular note is that Divisible and Decidable are fairly new to the Contravariant library and have already found use. Very cool.
http://hackage.haskell.org/package/contravariant-1.2/docs/Data-Functor-Contravariant-Divisible.html
“A Divisible contravariant functor is the contravariant analogue of Applicative.”
Decidable, which is what the author uses in the library, is a contravariant Alternative.
For any not familiar:
covariant functor: fmap :: (a -> b) -> f a -> f b covariant applicative: (<*>) :: f (a -> b) -> f a -> f b
Alternative is a monoid on applicative functors. It adds an identity ‘f a’, and an associative binary operation:
(<|>) :: f a -> f a -> f a
contravariant functor: contramap :: (a -> b) -> f b -> f a contravariant applicative: divide :: (a -> (b, c)) -> f b -> f c -> f a
contravariant alternative: lose :: (a -> Void) -> f a choose :: (a -> Either b c) -> f b -> f c -> f a
Author is using lose and choose in their library. See if you can suss out what they’re doing from those applications. :)
Very cute!