Permalink
Browse files

Contravariant Proxy

  • Loading branch information...
ekmett committed Feb 5, 2013
1 parent f15a450 commit a5e45565a5ca32ee8fa2a6a04c82323d1112f874
Showing with 9 additions and 4 deletions.
  1. +4 −0 Data/Functor/Contravariant.hs
  2. +5 −4 contravariant.cabal
@@ -42,6 +42,7 @@ import Data.Functor.Product
import Data.Functor.Constant
import Data.Functor.Compose
import Data.Functor.Reverse
+import Data.Proxy
import Prelude hiding ((.),id)
-- | Any instance should be subject to the following laws:
@@ -87,6 +88,9 @@ instance Contravariant f => Contravariant (Reverse f) where
contramap f = Reverse . contramap f . getReverse
{-# INLINE contramap #-}
+instance Contravariant Proxy where
+ contramap _ Proxy = Proxy
+
newtype Predicate a = Predicate { getPredicate :: a -> Bool }
-- | A 'Predicate' is a 'Contravariant' 'Functor', because 'contramap' can
View
@@ -1,6 +1,6 @@
name: contravariant
category: Control, Data
-version: 0.3
+version: 0.4
license: BSD3
cabal-version: >= 1.6
license-file: LICENSE
@@ -23,9 +23,10 @@ source-repository head
library
build-depends:
- base < 5,
- transformers >= 0.2 && < 0.4,
- transformers-compat >= 0.1 && < 1
+ base < 5,
+ tagged >= 0.4.4 && < 1,
+ transformers >= 0.2 && < 0.4,
+ transformers-compat >= 0.1 && < 1
exposed-modules:
Data.Functor.Contravariant
Data.Functor.Contravariant.Compose

0 comments on commit a5e4556

Please sign in to comment.