Created
November 16, 2019 11:28
-
-
Save phadej/af65ce17d1c27640a839abbd8a33746d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Convert p c | p -> c, c -> p where | |
toCabal :: p -> c | |
fromCabal :: c -> p | |
instance Convert P.Ver C.Version where | |
toCabal (P.Ver vs) = C.mkVersion vs | |
fromCabal v = P.Ver (C.versionNumbers v) | |
instance Convert P.PkgName C.PackageName where | |
toCabal (P.PkgName n) = C.mkPackageName (T.unpack n) | |
fromCabal pn = P.PkgName (T.pack (C.unPackageName pn)) | |
instance Convert P.PkgId C.PackageIdentifier where | |
toCabal (P.PkgId pn v) = C.PackageIdentifier (toCabal pn) (toCabal v) | |
fromCabal (C.PackageIdentifier pn v) = P.PkgId (fromCabal pn) (fromCabal v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment