Skip to content

Commit 2175a30

Browse files
committed
Expr.Types: mv instance TH.Lift NExpr into a proper place
1 parent cf884d7 commit 2175a30

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/Nix/Expr/Types.hs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -496,24 +496,6 @@ instance Serialise r => Serialise (NExprF r)
496496
instance IsString NExpr where
497497
fromString = Fix . NSym . fromString
498498

499-
instance TH.Lift (Fix NExprF) where
500-
lift =
501-
TH.dataToExpQ
502-
(\b ->
503-
do
504-
-- Binding on constructor ensures type match and gives type inference to TH
505-
HRefl <-
506-
eqTypeRep
507-
(Reflection.typeRep @Text)
508-
(Reflection.typeOf b )
509-
pure [| $(TH.lift b) |]
510-
)
511-
#if MIN_VERSION_template_haskell(2,17,0)
512-
liftTyped = unsafeCodeCoerce . lift
513-
#elif MIN_VERSION_template_haskell(2,16,0)
514-
liftTyped = TH.unsafeTExpCoerce . TH.lift
515-
#endif
516-
517499
#if !MIN_VERSION_hashable(1,3,1)
518500
-- there was none before, remove this in year >2022
519501
instance Hashable1 NonEmpty
@@ -531,6 +513,24 @@ type NExpr = Fix NExprF
531513
instance Serialise NExpr
532514
#endif
533515

516+
instance TH.Lift NExpr where
517+
lift =
518+
TH.dataToExpQ
519+
(\b ->
520+
do
521+
-- Binding on constructor ensures type match and gives type inference to TH
522+
HRefl <-
523+
eqTypeRep
524+
(Reflection.typeRep @Text)
525+
(Reflection.typeOf b )
526+
pure [| $(TH.lift b) |]
527+
)
528+
#if MIN_VERSION_template_haskell(2,17,0)
529+
liftTyped = unsafeCodeCoerce . lift
530+
#elif MIN_VERSION_template_haskell(2,16,0)
531+
liftTyped = TH.unsafeTExpCoerce . TH.lift
532+
#endif
533+
534534

535535
-- ** @class NExprAnn@
536536

0 commit comments

Comments
 (0)