Skip to content
This repository was archived by the owner on Sep 23, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hs/lib/Nixage/Project/Extensible.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type family XProject x :: *
-- | Extensible package version specification
data ExtraDepVersion x
= HackageDepVersion !(XHackageDepVersion x) PackageVersion
| SourceDepVersion !(XSourceDepVersion x) ExternalSource NixHash (Maybe FilePath)
| SourceDepVersion !(XSourceDepVersion x) ExternalSource (Maybe NixHash) (Maybe FilePath)
| XExtraDepVersion !(XXExtraDepVersion x)
deriving (Generic)

Expand Down
10 changes: 5 additions & 5 deletions hs/lib/Nixage/Project/Native.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ pattern HackageDepVersionNative :: PackageVersion
pattern HackageDepVersionNative pv = HackageDepVersion () pv

pattern SourceDepVersionNative :: ExternalSource
-> NixHash
-> Maybe NixHash
-> Maybe FilePath
-> ExtraDepVersion AstNixage
pattern SourceDepVersionNative es nh msd = SourceDepVersion () es nh msd
pattern SourceDepVersionNative es mnh msd = SourceDepVersion () es mnh msd


instance Monad m => ToNix (ExtraDepVersion AstNixage) m NExpr where
toNix (HackageDepVersion () s) = return $ mkStr s
toNix (SourceDepVersion () (GitSource git rev) sha256 subdir) =
toNix (SourceDepVersion () (GitSource git rev) mnh msd) =
return $ mkNonRecSet $
[ "git" $= mkStr git
, "rev" $= mkStr rev
, "sha256" $= mkStr sha256
]
<> maybeToList (("subdir" $=) . mkStr . toText <$> subdir)
<> maybeToList (("sha256" $=) . mkStr <$> mnh)
<> maybeToList (("subdir" $=) . mkStr . toText <$> msd)
toNix (XExtraDepVersion v) = absurd v

instance Monad m => ToNix StackageVersion m NExpr where
Expand Down
14 changes: 7 additions & 7 deletions hs/lib/Nixage/Project/Yaml.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ pattern HackageDepVersionYaml :: PackageVersion
pattern HackageDepVersionYaml pv = HackageDepVersion () pv

pattern SourceDepVersionYaml :: ExternalSource
-> NixHash
-> Maybe NixHash
-> Maybe FilePath
-> ExtraDepVersion AstYaml
pattern SourceDepVersionYaml es nh msd = SourceDepVersion () es nh msd
pattern SourceDepVersionYaml es mnh msd = SourceDepVersion () es mnh msd

instance FromJSON (ExtraDepVersion AstYaml) where
parseJSON (String s) = pure $ HackageDepVersionYaml s
parseJSON (Object v) =
SourceDepVersionYaml
<$> externalSourceP
<*> v .: "sha256"
<*> v .: "subdir"
<*> v .:? "sha256"
<*> v .:? "subdir"
where
externalSourceP =
GitSource
Expand All @@ -90,6 +90,6 @@ projectYamlToProjectNative (Project () r mnv msv ps eds mgo) =
ProjectNative r mnv msv ps eds' mgo
where
eds' = eds <&> \case
HackageDepVersion () v -> HackageDepVersionNative v
SourceDepVersion () es nh msb -> SourceDepVersionNative es nh msb
XExtraDepVersion v -> absurd v
HackageDepVersion () v -> HackageDepVersionNative v
SourceDepVersion () es mnh msb -> SourceDepVersionNative es mnh msb
XExtraDepVersion v -> absurd v