Skip to content

Commit 291ae54

Browse files
committed
Context: Context: rename accessors
1 parent 5d206d1 commit 291ae54

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/Nix/Context.hs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,25 @@ import Nix.Expr.Types.Annotated ( SrcSpan
99
)
1010

1111
-- 2021-07-18: NOTE: It should be Options -> Scopes -> Frames -> Source(span)
12-
data Context m t = Context
13-
{ scopes :: Scopes m t
14-
, source :: SrcSpan
15-
, frames :: Frames
16-
, options :: Options
12+
data Context m t =
13+
Context
14+
{ getOptions :: Options
15+
, getScopes :: Scopes m t
16+
, getSource :: SrcSpan
17+
, getFrames :: Frames
1718
}
1819

1920
instance Has (Context m t) (Scopes m t) where
20-
hasLens f a = (\x -> a { scopes = x }) <$> f (scopes a)
21+
hasLens f a = (\x -> a { getScopes = x }) <$> f (getScopes a)
2122

2223
instance Has (Context m t) SrcSpan where
23-
hasLens f a = (\x -> a { source = x }) <$> f (source a)
24+
hasLens f a = (\x -> a { getSource = x }) <$> f (getSource a)
2425

2526
instance Has (Context m t) Frames where
26-
hasLens f a = (\x -> a { frames = x }) <$> f (frames a)
27+
hasLens f a = (\x -> a { getFrames = x }) <$> f (getFrames a)
2728

2829
instance Has (Context m t) Options where
29-
hasLens f a = (\x -> a { options = x }) <$> f (options a)
30+
hasLens f a = (\x -> a { getOptions = x }) <$> f (getOptions a)
3031

3132
newContext :: Options -> Context m t
32-
newContext = Context mempty nullSpan mempty
33+
newContext o = Context o mempty nullSpan mempty

0 commit comments

Comments
 (0)