File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ import Lens.Family2.TH
1818
1919import Nix.Expr.Types.Annotated
2020import Nix.Scope
21+ import Nix.Value ( NValue , NValue' (NValue ) )
22+ import Control.Monad.Free ( Free (Pure , Free ) )
2123
2224data Provenance m v = Provenance
2325 { _lexicalScope :: Scopes m v
@@ -60,3 +62,15 @@ instance HasCitations m v (NCited m v a) where
6062class HasCitations1 m v f where
6163 citations1 :: f a -> [Provenance m v ]
6264 addProvenance1 :: Provenance m v -> f a -> f a
65+
66+ instance HasCitations1 m v f
67+ => HasCitations m v (NValue' t f m a ) where
68+ citations (NValue f) = citations1 f
69+ addProvenance x (NValue f) = NValue (addProvenance1 x f)
70+
71+ instance (HasCitations1 m v f , HasCitations m v t )
72+ => HasCitations m v (NValue t f m ) where
73+ citations (Pure t) = citations t
74+ citations (Free v) = citations v
75+ addProvenance x (Pure t) = Pure (addProvenance x t)
76+ addProvenance x (Free v) = Free (addProvenance x v)
Original file line number Diff line number Diff line change @@ -184,18 +184,6 @@ prettyAtom atom = simpleExpr $ pretty $ unpack $ atomText atom
184184prettyNix :: NExpr -> Doc ann
185185prettyNix = withoutParens . foldFix exprFNixDoc
186186
187- instance HasCitations1 m v f
188- => HasCitations m v (NValue' t f m a ) where
189- citations (NValue f) = citations1 f
190- addProvenance x (NValue f) = NValue (addProvenance1 x f)
191-
192- instance (HasCitations1 m v f , HasCitations m v t )
193- => HasCitations m v (NValue t f m ) where
194- citations (Pure t) = citations t
195- citations (Free v) = citations v
196- addProvenance x (Pure t) = Pure (addProvenance x t)
197- addProvenance x (Free v) = Free (addProvenance x v)
198-
199187prettyOriginExpr
200188 :: forall t f m ann
201189 . HasCitations1 m (NValue t f m ) f
You can’t perform that action at this time.
0 commit comments