File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,10 @@ data SrcSpan = SrcSpan
5454-- ** Instances
5555
5656instance Semigroup SrcSpan where
57- s1 <> s2 = SrcSpan ((min `on` spanBegin) s1 s2) ((max `on` spanEnd) s1 s2)
57+ s1 <> s2 =
58+ SrcSpan
59+ ((min `on` spanBegin) s1 s2)
60+ ((max `on` spanEnd ) s1 s2)
5861
5962instance Binary SrcSpan
6063instance ToJSON SrcSpan
@@ -116,16 +119,19 @@ $(deriveJSON2 defaultOptions ''Ann)
116119instance (Serialise ann , Serialise a ) => Serialise (Ann ann a )
117120#endif
118121
119- #ifdef MIN_VERSION_serialise
120- instance Serialise r => Serialise (Compose (Ann SrcSpan ) NExprF r ) where
121- encode (Compose (Ann ann a)) = encode ann <> encode a
122- decode = (Compose . ) . Ann <$> decode <*> decode
123- #endif
124-
125122-- ** @NExprLoc{,F}@ - annotated Nix expression
126123
127124type NExprLocF = AnnF SrcSpan NExprF
128125
126+ #ifdef MIN_VERSION_serialise
127+ instance Serialise r => Serialise (NExprLocF r ) where
128+ encode (Compose (Ann ann a)) = encode ann <> encode a
129+ decode =
130+ liftA2 ((Compose . ) . Ann )
131+ decode
132+ decode
133+ #endif
134+
129135instance Binary r => Binary (NExprLocF r )
130136
131137-- | Annotated Nix expression (each subexpression direct to its source location).
You can’t perform that action at this time.
0 commit comments