Changes between Version 5 and Version 6 of TemplateHaskell/PackageKeyChanges


Ignore:
Timestamp:
Oct 19, 2015 7:18:50 PM (4 years ago)
Author:
ezyang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TemplateHaskell/PackageKeyChanges

    v5 v6  
    1111 * [https://github.com/ekmett/lens/issues/496 Similar lens bug]
    1212
    13 == Rename PkgName to PkgKey ==
     13== Rename PkgName to UnitId ==
    1414
    1515Currently, a TH `NameG` contains a `PkgName`, defined as:
     
    1919}}}
    2020
    21 This is badly misleading, even in the old world order, since these needed version numbers as well (except for wired-in packages, which are always just a bare package name). We propose that this be renamed to `PkgKey`:
     21This is badly misleading, even in the old world order, since these needed version numbers as well (except for wired-in packages, which are always just a bare package name). We propose that this be renamed to `UnitId`:
    2222
    2323{{{
    24 newtype PkgKey = PkgKey String
    25 mkPackageKey :: String -> PackageKey
    26 mkPackageKey = PkgKey
     24newtype UnitId = UnitId String
     25mkUnitId :: String -> UnitId
     26mkUnitId = UnitId
    2727}}}
    2828
     
    3131Here is the GitHub search for uses of `NameG`, which usually indicates a package key is being manipulated directly: https://github.com/search?l=haskell&q=NameG&type=Code&utf8=%E2%9C%93
    3232
    33 == Querying about packages ==
     33== Querying about units ==
    3434
    35 Package keys are somewhat hard to synthesize, so we also offer an API for querying the package database of the GHC which is compiling your code for information about packages.  So, we introduce a new abstract data type:
     35Unit IDs are somewhat hard to synthesize, so we also offer an API for querying the package database of the GHC which is compiling your code for information about packages.  So, we introduce a new abstract data type:
    3636
    3737{{{
    38 data Package
    39 packageKey :: Package -> PkgKey
    40 packageVersionString :: Package -> String
    41 packageName          :: Package -> String
     38data Unit
     39unitId :: Unit -> UnitId
     40unitVersionString :: Unit -> String
     41unitPackageName   :: Unit -> String
    4242
    43 packageDependencies :: Package -> Q [Package]
     43unitDependencies :: Unit -> Q [Unit]
    4444}}}
    4545
     
    4747
    4848{{{
    49 searchPackage :: String -- Package name
    50               -> String -- Version
    51               -> Q [Package]
     49searchUnit :: String -- Package name
     50           -> String -- Version
     51           -> Q [Unit]
    5252
    53 reifyPackage :: PkgKey -> Q Package
     53reifyUnit :: UnitId -> Q Unit
    5454}}}
    5555
     
    7171
    7272{{{
    73 modulePackageKey :: Module -> PkgKey
     73moduleUnitId :: Module -> UnitId
    7474}}}
    7575
     
    7777
    7878{{{
    79  thisPackageKey :: Q PkgKey
    80  thisPackageKey = fmap (modulePackageKey . mi_this_mod) qReifyModule
     79 thisUnitId :: Q UnitId
     80 thisUnitId = fmap (moduleUnitId . mi_this_mod) qReifyModule
    8181
    82  thisPackage :: Q Package
    83  thisPackage = reifyPackage =<< thisPackageKey
     82 thisPackage :: Q Unit
     83 thisPackage = reifyUnit =<< thisUnitId
    8484}}}
    8585