Skip to content

Commit

Permalink
Expr.Types: add to{,N}SourcePos (iso between types)
Browse files Browse the repository at this point in the history
`coerce` has problems coercing it in 8.10, so helping with it.
  • Loading branch information
Anton-Latukha committed Jan 19, 2022
1 parent b24d1de commit d395786
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Nix/Expr/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ data NSourcePos =
, Generic
)

-- | Helper for 'SourcePos' -> 'NSourcePos' coersion.
toNSourcePos :: SourcePos -> NSourcePos
toNSourcePos (SourcePos f l c) =
NSourcePos (coerce f) (coerce l) (coerce c)

-- | Helper for 'NSourcePos' -> 'SourcePos' coersion.
toSourcePos :: NSourcePos -> SourcePos
toSourcePos (NSourcePos f l c) =
SourcePos (coerce f) (coerce l) (coerce c)

-- 2021-07-16: NOTE: Should replace @ParamSet@ List
-- | > Hashmap VarName -- type synonym
type AttrSet = HashMap VarName
Expand Down

0 comments on commit d395786

Please sign in to comment.