1
1
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:
Rob Rix 2019-10-25 13:28:15 -04:00
parent 9a85fddccd
commit cb0aa77a93
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -9,7 +9,6 @@ module Data.Functor.Classes.Generic
, defaultGShow1Options
, genericLiftShowsPrec
, genericLiftShowsPrecWithOptions
, Generically (..)
) where
import Data.Functor.Classes
@ -180,11 +179,3 @@ instance (Show1 f, GShow1 g) => GShow1 (f :.: g) where
showBraces :: Bool -> ShowS -> ShowS
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