Commit 5097f380 authored by Andrew Martin's avatar Andrew Martin Committed by Ben Gamari
Browse files

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
parent 4a93e4f9
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment