mirror of
https://github.com/github/semantic.git
synced 2024-11-24 17:04:47 +03:00
🔥 the Generically newtype.
This commit is contained in:
parent
9a85fddccd
commit
cb0aa77a93
@ -9,7 +9,6 @@ module Data.Functor.Classes.Generic
|
|||||||
, defaultGShow1Options
|
, defaultGShow1Options
|
||||||
, genericLiftShowsPrec
|
, genericLiftShowsPrec
|
||||||
, genericLiftShowsPrecWithOptions
|
, genericLiftShowsPrecWithOptions
|
||||||
, Generically (..)
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.Functor.Classes
|
import Data.Functor.Classes
|
||||||
@ -180,11 +179,3 @@ instance (Show1 f, GShow1 g) => GShow1 (f :.: g) where
|
|||||||
|
|
||||||
showBraces :: Bool -> ShowS -> ShowS
|
showBraces :: Bool -> ShowS -> ShowS
|
||||||
showBraces should rest = if should then showChar '{' . rest . showChar '}' else rest
|
showBraces should rest = if should then showChar '{' . rest . showChar '}' else rest
|
||||||
|
|
||||||
-- | Used with the `DerivingVia` extension to provide fast derivations for
|
|
||||||
-- 'Eq1', 'Show1', and 'Ord1'.
|
|
||||||
newtype Generically f a = Generically { unGenerically :: f a }
|
|
||||||
|
|
||||||
instance (Generic1 f, GEq1 (Rep1 f)) => Eq1 (Generically f) where liftEq eq (Generically a1) (Generically a2) = genericLiftEq eq a1 a2
|
|
||||||
instance (Generic1 f, GEq1 (Rep1 f), GOrd1 (Rep1 f)) => Ord1 (Generically f) where liftCompare compare (Generically a1) (Generically a2) = genericLiftCompare compare a1 a2
|
|
||||||
instance (Generic1 f, GShow1 (Rep1 f)) => Show1 (Generically f) where liftShowsPrec d sp sl = genericLiftShowsPrec d sp sl . unGenerically
|
|
||||||
|
Loading…
Reference in New Issue
Block a user