summaryrefslogtreecommitdiff
path: root/libraries/base
diff options
context:
space:
mode:
authorAndrew Martin <amartin@layer3com.com>2016-03-29 10:57:47 +0200
committerBen Gamari <ben@smart-cactus.org>2016-03-29 12:43:07 +0200
commit5097f3802124cfbe6810bff8110df91d4c52096b (patch)
tree20d6558c3695d0bd1de2d3ebdb0859218b490081 /libraries/base
parent4a93e4f9a86a62d1cdf2e666f977b8b58e61eaaf (diff)
downloadhaskell-5097f3802124cfbe6810bff8110df91d4c52096b.tar.gz
Add Data.Functor.Classes instances for Proxy (trac issue #11756)
Test Plan: currently no test plan Reviewers: hvr, RyanGlScott, bgamari, austin Reviewed By: RyanGlScott, bgamari, austin Subscribers: thomie, RyanGlScott, andrewthad Differential Revision: https://phabricator.haskell.org/D2051 GHC Trac Issues: #11756
Diffstat (limited to 'libraries/base')
-rw-r--r--libraries/base/Data/Functor/Classes.hs18
-rw-r--r--libraries/base/changelog.md3
2 files changed, 21 insertions, 0 deletions
diff --git a/libraries/base/Data/Functor/Classes.hs b/libraries/base/Data/Functor/Classes.hs
index 0ec6008f5a..5f1b12c84d 100644
--- a/libraries/base/Data/Functor/Classes.hs
+++ b/libraries/base/Data/Functor/Classes.hs
@@ -62,6 +62,7 @@ module Data.Functor.Classes (
import Control.Applicative (Const(Const))
import Data.Functor.Identity (Identity(Identity))
+import Data.Proxy (Proxy(Proxy))
import Data.Monoid (mappend)
import Text.Show (showListWith)
@@ -354,6 +355,23 @@ instance (Read a) => Read1 (Const a) where
instance (Show a) => Show1 (Const a) where
liftShowsPrec = liftShowsPrec2 showsPrec showList
+-- | @since 4.9.0.0
+instance Eq1 Proxy where
+ liftEq _ _ _ = True
+
+-- | @since 4.9.0.0
+instance Ord1 Proxy where
+ liftCompare _ _ _ = EQ
+
+-- | @since 4.9.0.0
+instance Show1 Proxy where
+ liftShowsPrec _ _ _ _ = showString "Proxy"
+
+-- | @since 4.9.0.0
+instance Read1 Proxy where
+ liftReadsPrec _ _ d =
+ readParen (d > 10) (\r -> [(Proxy, s) | ("Proxy",s) <- lex r ])
+
-- Building blocks
-- | @'readsData' p d@ is a parser for datatypes where each alternative
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index 92451b9b42..cb3eceda98 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -78,6 +78,9 @@
`Data.Functor.Product`, and `Data.Functor.Sum` (previously provided by
`transformers` package). (#11135)
+ * New instances for `Proxy`: `Eq1`, `Ord1`, `Show1`, `Read1`. All
+ of the classes are from `Data.Functor.Classes` (#11756).
+
* New module `Control.Monad.Fail` providing new `MonadFail(fail)`
class (#10751)