packageDD :: [PackageIdentifier]
    -> FilePath
    -> [ModuleName]
    -> Int
    -> [(Text, FieldDescription PackageDescriptionEd)]
    -> FieldDescription PackageDescriptionEd
packageDD packages fp modules numBuildInfos extras = NFD ([
    ((__ "Package"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Synopsis")
           $ paraSynopsis <<<- ParaSynopsis (__ "A one-line summary of this package")
           $ emptyParams)
            (synopsis . pd)
            (\ a b -> b{pd = (pd b){synopsis = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Package Identifier") $ emptyParams)
            (package . pd)
            (\ a b -> b{pd = (pd b){package = a}})
            packageEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Description")
                $ paraSynopsis <<<- ParaSynopsis (__ "A more verbose description of this package")
                    $ paraShadow <<<- ParaShadow ShadowOut
                        $ paraMinSize <<<- ParaMinSize (-1,210)
                            $ emptyParams)
            (T.pack . description . pd)
            (\ a b -> b{pd = (pd b){description = T.unpack $ if T.null a then " " else a}})
            multilineStringEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Homepage") $ emptyParams)
            (homepage . pd)
            (\ a b -> b{pd = (pd b){homepage = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Package URL") $ emptyParams)
            (pkgUrl . pd)
            (\ a b -> b{pd = (pd b){pkgUrl = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Category") $ emptyParams)
            (category . pd)
            (\ a b -> b{pd = (pd b){category = a}})
            (stringEditor (const True) True)
    ]),
    ((__ "Description"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Stability") $ emptyParams)
            (stability . pd)
            (\ a b -> b{pd = (pd b){stability = a}})
            (stringEditor (const True) True)
            -- TODO Fix this up to work with current Cabal
--    ,   mkField
--            (paraName <<<- ParaName (__ "License") $ emptyParams)
--            (license . pd)
--            (\ a b -> b{pd = (pd b){license = a}})
--            (comboSelectionEditor [GPL, LGPL, BSD3, BSD4, PublicDomain, AllRightsReserved, OtherLicense] show)
    ,   mkField
#if MIN_VERSION_Cabal(1,22,0)
            (paraName <<<- ParaName (__ "License Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of license files.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (licenseFiles . pd)
            (\ a b -> b{pd = (pd b){licenseFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
#else
            (paraName <<<- ParaName (__ "License File") $ emptyParams)
            (licenseFile . pd)
            (\ a b -> b{pd = (pd b){licenseFile = a}})
            (fileEditor (Just fp) FileChooserActionOpen (__ "Select file"))
#endif
    ,   mkField
            (paraName <<<- ParaName (__ "Copyright") $ emptyParams)
            (copyright . pd)
            (\ a b -> b{pd = (pd b){copyright = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Author") $ emptyParams)
            (author . pd)
            (\ a b -> b{pd = (pd b){author = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Maintainer") $ emptyParams)
            (maintainer . pd)
            (\ a b -> b{pd = (pd b){maintainer = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Bug Reports") $ emptyParams)
            (bugReports . pd)
            (\ a b -> b{pd = (pd b){bugReports = a}})
            (stringEditor (const True) True)
    ]),
--    ("Repositories", VFD emptyParams [
--        mkField
--            (paraName <<<- ParaName "Source Repositories" $ emptyParams)
--            (sourceRepos . pd)
--            (\ a b -> b{pd = (pd b){sourceRepos = a}})
--            reposEditor]),
    ((__ "Dependencies  "), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Build Dependencies")
                $ paraSynopsis <<<- ParaSynopsis (__ "Does this package depends on other packages?")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (nub . buildDepends . pd)
            (\ a b -> b{pd = (pd b){buildDepends = a}})
            (dependenciesEditor packages)
    ]),
    ((__ "Meta Dep."), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Cabal version")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "Does this package depends on a specific version of Cabal?")
                    $ paraShadow <<<- ParaShadow ShadowIn $ emptyParams)
            (specVersion . pd)
            (\ a b -> b{pd = (pd b){specVersionRaw = Left a}})
            versionEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Tested with compiler")
                $ paraShadow <<<- ParaShadow ShadowIn
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,150)
                            $ emptyParams)
            (\a -> case (testedWith . pd) a of
                []          -> []--(GHC,anyVersion)]
                l           -> l)
            (\ a b -> b{pd = (pd b){testedWith = a}})
            testedWithEditor
    ]),
    ((__ "Data Files"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Data Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of files to be installed for run-time use by the package.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (dataFiles . pd)
            (\ a b -> b{pd = (pd b){dataFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ,   mkField
            (paraName <<<- ParaName (__ "Data directory") $ emptyParams)
            (dataDir . pd)
            (\ a b -> b{pd = (pd b){dataDir = a}})
            (fileEditor (Just fp) FileChooserActionSelectFolder (__ "Select file"))
    ]),
    ((__ "Extra Files"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Extra Source Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of additional files to be included in source distributions.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,120)
                            $ emptyParams)
            (extraSrcFiles . pd)
            (\ a b -> b{pd = (pd b){extraSrcFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ,   mkField
            (paraName <<<-  ParaName (__ "Extra Tmp Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of additional files or directories to be removed by setup clean.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,120)
                            $ emptyParams)
            (extraTmpFiles . pd)
            (\ a b -> b{pd = (pd b){extraTmpFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ]),
    ((__ "Other"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Build Type")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe executable programs contained in the package")
                        $ paraShadow <<<- ParaShadow ShadowIn
                            $ paraDirection <<<- ParaDirection Vertical
                                $ emptyParams)
            (buildType . pd)
            (\ a b -> b{pd = (pd b){buildType = a}})
            (maybeEditor (buildTypeEditor, emptyParams) True (__ "Specify?"))
    ,   mkField
            (paraName <<<- ParaName (__ "Custom Fields")
                $ paraShadow <<<- ParaShadow ShadowIn
                    $ paraMinSize <<<- ParaMinSize (-1,150)
                        $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            (customFieldsPD . pd)
            (\ a b -> b{pd = (pd b){customFieldsPD = a}})
            (multisetEditor
                (ColumnDescr True [((__ "Name"),\(n,_) -> [cellText := T.pack n])
                                   ,((__ "Value"),\(_,v) -> [cellText := T.pack v])])
                ((pairEditor
                    (stringxEditor (const True),emptyParams)
                    (stringEditor (const True) True,emptyParams)),emptyParams)
            Nothing
            Nothing)
    ]),
    ((__ "Executables"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Executables")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe executable programs contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            exes
            (\ a b -> b{exes = a})
            (executablesEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Tests"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Tests")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe tests contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            tests
            (\ a b -> b{tests = a})
            (testsEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Benchmarks"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Benchmarks")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe tests contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            bms
            (\ a b -> b{bms = a})
            (benchmarksEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Library"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Library")
           $ paraSynopsis <<<- ParaSynopsis
             (__ "If the package contains a library, specify the exported modules here")
           $ paraDirection <<<- ParaDirection Vertical
           $ paraShadow <<<- ParaShadow ShadowIn $ emptyParams)
            mbLib
            (\ a b -> b{mbLib = a})
            (maybeEditor (libraryEditor (Just fp) modules numBuildInfos,
                paraName <<<- ParaName (__ "Specify exported modules")
                $ emptyParams) True
                (__ "Does this package contain a library?"))
    ])
    ] ++ extras)
packageDD :: [PackageIdentifier]
    -> FilePath
    -> [ModuleName]
    -> Int
    -> [(Text, FieldDescription PackageDescriptionEd)]
    -> FieldDescription PackageDescriptionEd
packageDD packages fp modules numBuildInfos extras = NFD ([
    ((__ "Package"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Synopsis")
           $ paraSynopsis <<<- ParaSynopsis (__ "A one-line summary of this package")
           $ emptyParams)
            (synopsis . pd)
            (\ a b -> b{pd = (pd b){synopsis = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Package Identifier") $ emptyParams)
            (package . pd)
            (\ a b -> b{pd = (pd b){package = a}})
            packageEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Description")
                $ paraSynopsis <<<- ParaSynopsis (__ "A more verbose description of this package")
                    $ paraShadow <<<- ParaShadow ShadowOut
                        $ paraMinSize <<<- ParaMinSize (-1,210)
                            $ emptyParams)
            (T.pack . description . pd)
            (\ a b -> b{pd = (pd b){description = T.unpack $ if T.null a then " " else a}})
            multilineStringEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Homepage") $ emptyParams)
            (homepage . pd)
            (\ a b -> b{pd = (pd b){homepage = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Package URL") $ emptyParams)
            (pkgUrl . pd)
            (\ a b -> b{pd = (pd b){pkgUrl = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Category") $ emptyParams)
            (category . pd)
            (\ a b -> b{pd = (pd b){category = a}})
            (stringEditor (const True) True)
    ]),
    ((__ "Description"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Stability") $ emptyParams)
            (stability . pd)
            (\ a b -> b{pd = (pd b){stability = a}})
            (stringEditor (const True) True)
            -- TODO Fix this up to work with current Cabal
--    ,   mkField
--            (paraName <<<- ParaName (__ "License") $ emptyParams)
--            (license . pd)
--            (\ a b -> b{pd = (pd b){license = a}})
--            (comboSelectionEditor [GPL, LGPL, BSD3, BSD4, PublicDomain, AllRightsReserved, OtherLicense] show)
    ,   mkField
#if MIN_VERSION_Cabal(1,22,0)
            (paraName <<<- ParaName (__ "License Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of license files.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (licenseFiles . pd)
            (\ a b -> b{pd = (pd b){licenseFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
#else
            (paraName <<<- ParaName (__ "License File") $ emptyParams)
            (licenseFile . pd)
            (\ a b -> b{pd = (pd b){licenseFile = a}})
            (fileEditor (Just fp) FileChooserActionOpen (__ "Select file"))
#endif
    ,   mkField
            (paraName <<<- ParaName (__ "Copyright") $ emptyParams)
            (copyright . pd)
            (\ a b -> b{pd = (pd b){copyright = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Author") $ emptyParams)
            (author . pd)
            (\ a b -> b{pd = (pd b){author = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Maintainer") $ emptyParams)
            (maintainer . pd)
            (\ a b -> b{pd = (pd b){maintainer = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Bug Reports") $ emptyParams)
            (bugReports . pd)
            (\ a b -> b{pd = (pd b){bugReports = a}})
            (stringEditor (const True) True)
    ]),
--    ("Repositories", VFD emptyParams [
--        mkField
--            (paraName <<<- ParaName "Source Repositories" $ emptyParams)
--            (sourceRepos . pd)
--            (\ a b -> b{pd = (pd b){sourceRepos = a}})
--            reposEditor]),
    ((__ "Dependencies  "), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Build Dependencies")
                $ paraSynopsis <<<- ParaSynopsis (__ "Does this package depends on other packages?")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (nub . buildDepends . pd)
            (\ a b -> b{pd = (pd b){buildDepends = a}})
            (dependenciesEditor packages)
    ]),
    ((__ "Meta Dep."), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Cabal version")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "Does this package depends on a specific version of Cabal?")
                    $ paraShadow <<<- ParaShadow ShadowIn $ emptyParams)
            (specVersion . pd)
            (\ a b -> b{pd = (pd b){specVersionRaw = Left a}})
            versionEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Tested with compiler")
                $ paraShadow <<<- ParaShadow ShadowIn
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,150)
                            $ emptyParams)
            (\a -> case (testedWith . pd) a of
                []          -> []--(GHC,anyVersion)]
                l           -> l)
            (\ a b -> b{pd = (pd b){testedWith = a}})
            testedWithEditor
    ]),
    ((__ "Data Files"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Data Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of files to be installed for run-time use by the package.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (dataFiles . pd)
            (\ a b -> b{pd = (pd b){dataFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ,   mkField
            (paraName <<<- ParaName (__ "Data directory") $ emptyParams)
            (dataDir . pd)
            (\ a b -> b{pd = (pd b){dataDir = a}})
            (fileEditor (Just fp) FileChooserActionSelectFolder (__ "Select file"))
    ]),
    ((__ "Extra Files"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Extra Source Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of additional files to be included in source distributions.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,120)
                            $ emptyParams)
            (extraSrcFiles . pd)
            (\ a b -> b{pd = (pd b){extraSrcFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ,   mkField
            (paraName <<<-  ParaName (__ "Extra Tmp Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of additional files or directories to be removed by setup clean.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,120)
                            $ emptyParams)
            (extraTmpFiles . pd)
            (\ a b -> b{pd = (pd b){extraTmpFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ]),
    ((__ "Other"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Build Type")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe executable programs contained in the package")
                        $ paraShadow <<<- ParaShadow ShadowIn
                            $ paraDirection <<<- ParaDirection Vertical
                                $ emptyParams)
            (buildType . pd)
            (\ a b -> b{pd = (pd b){buildType = a}})
            (maybeEditor (buildTypeEditor, emptyParams) True (__ "Specify?"))
    ,   mkField
            (paraName <<<- ParaName (__ "Custom Fields")
                $ paraShadow <<<- ParaShadow ShadowIn
                    $ paraMinSize <<<- ParaMinSize (-1,150)
                        $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            (customFieldsPD . pd)
            (\ a b -> b{pd = (pd b){customFieldsPD = a}})
            (multisetEditor
                (ColumnDescr True [((__ "Name"),\(n,_) -> [cellText := T.pack n])
                                   ,((__ "Value"),\(_,v) -> [cellText := T.pack v])])
                ((pairEditor
                    (stringxEditor (const True),emptyParams)
                    (stringEditor (const True) True,emptyParams)),emptyParams)
            Nothing
            Nothing)
    ]),
    ((__ "Executables"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Executables")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe executable programs contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            exes
            (\ a b -> b{exes = a})
            (executablesEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Tests"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Tests")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe tests contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            tests
            (\ a b -> b{tests = a})
            (testsEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Benchmarks"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Benchmarks")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe tests contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            bms
            (\ a b -> b{bms = a})
            (benchmarksEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Library"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Library")
           $ paraSynopsis <<<- ParaSynopsis
             (__ "If the package contains a library, specify the exported modules here")
           $ paraDirection <<<- ParaDirection Vertical
           $ paraShadow <<<- ParaShadow ShadowIn $ emptyParams)
            mbLib
            (\ a b -> b{mbLib = a})
            (maybeEditor (libraryEditor (Just fp) modules numBuildInfos,
                paraName <<<- ParaName (__ "Specify exported modules")
                $ emptyParams) True
                (__ "Does this package contain a library?"))
    ])
    ] ++ extras)
packageDD packages fp modules numBuildInfos extras = NFD ([
    ((__ "Package"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Synopsis")
           $ paraSynopsis <<<- ParaSynopsis (__ "A one-line summary of this package")
           $ emptyParams)
            (synopsis . pd)
            (\ a b -> b{pd = (pd b){synopsis = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Package Identifier") $ emptyParams)
            (package . pd)
            (\ a b -> b{pd = (pd b){package = a}})
            packageEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Description")
                $ paraSynopsis <<<- ParaSynopsis (__ "A more verbose description of this package")
                    $ paraShadow <<<- ParaShadow ShadowOut
                        $ paraMinSize <<<- ParaMinSize (-1,210)
                            $ emptyParams)
            (T.pack . description . pd)
            (\ a b -> b{pd = (pd b){description = T.unpack $ if T.null a then " " else a}})
            multilineStringEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Homepage") $ emptyParams)
            (homepage . pd)
            (\ a b -> b{pd = (pd b){homepage = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Package URL") $ emptyParams)
            (pkgUrl . pd)
            (\ a b -> b{pd = (pd b){pkgUrl = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Category") $ emptyParams)
            (category . pd)
            (\ a b -> b{pd = (pd b){category = a}})
            (stringEditor (const True) True)
    ]),
    ((__ "Description"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Stability") $ emptyParams)
            (stability . pd)
            (\ a b -> b{pd = (pd b){stability = a}})
            (stringEditor (const True) True)
            -- TODO Fix this up to work with current Cabal
--    ,   mkField
--            (paraName <<<- ParaName (__ "License") $ emptyParams)
--            (license . pd)
--            (\ a b -> b{pd = (pd b){license = a}})
--            (comboSelectionEditor [GPL, LGPL, BSD3, BSD4, PublicDomain, AllRightsReserved, OtherLicense] show)
    ,   mkField
#if MIN_VERSION_Cabal(1,22,0)
            (paraName <<<- ParaName (__ "License Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of license files.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (licenseFiles . pd)
            (\ a b -> b{pd = (pd b){licenseFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
#else
            (paraName <<<- ParaName (__ "License File") $ emptyParams)
            (licenseFile . pd)
            (\ a b -> b{pd = (pd b){licenseFile = a}})
            (fileEditor (Just fp) FileChooserActionOpen (__ "Select file"))
#endif
    ,   mkField
            (paraName <<<- ParaName (__ "Copyright") $ emptyParams)
            (copyright . pd)
            (\ a b -> b{pd = (pd b){copyright = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Author") $ emptyParams)
            (author . pd)
            (\ a b -> b{pd = (pd b){author = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Maintainer") $ emptyParams)
            (maintainer . pd)
            (\ a b -> b{pd = (pd b){maintainer = a}})
            (stringEditor (const True) True)
    ,   mkField
            (paraName <<<- ParaName (__ "Bug Reports") $ emptyParams)
            (bugReports . pd)
            (\ a b -> b{pd = (pd b){bugReports = a}})
            (stringEditor (const True) True)
    ]),
--    ("Repositories", VFD emptyParams [
--        mkField
--            (paraName <<<- ParaName "Source Repositories" $ emptyParams)
--            (sourceRepos . pd)
--            (\ a b -> b{pd = (pd b){sourceRepos = a}})
--            reposEditor]),
    ((__ "Dependencies  "), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Build Dependencies")
                $ paraSynopsis <<<- ParaSynopsis (__ "Does this package depends on other packages?")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (nub . buildDepends . pd)
            (\ a b -> b{pd = (pd b){buildDepends = a}})
            (dependenciesEditor packages)
    ]),
    ((__ "Meta Dep."), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Cabal version")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "Does this package depends on a specific version of Cabal?")
                    $ paraShadow <<<- ParaShadow ShadowIn $ emptyParams)
            (specVersion . pd)
            (\ a b -> b{pd = (pd b){specVersionRaw = Left a}})
            versionEditor
    ,   mkField
            (paraName <<<- ParaName (__ "Tested with compiler")
                $ paraShadow <<<- ParaShadow ShadowIn
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,150)
                            $ emptyParams)
            (\a -> case (testedWith . pd) a of
                []          -> []--(GHC,anyVersion)]
                l           -> l)
            (\ a b -> b{pd = (pd b){testedWith = a}})
            testedWithEditor
    ]),
    ((__ "Data Files"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Data Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of files to be installed for run-time use by the package.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,250)
                            $ emptyParams)
            (dataFiles . pd)
            (\ a b -> b{pd = (pd b){dataFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ,   mkField
            (paraName <<<- ParaName (__ "Data directory") $ emptyParams)
            (dataDir . pd)
            (\ a b -> b{pd = (pd b){dataDir = a}})
            (fileEditor (Just fp) FileChooserActionSelectFolder (__ "Select file"))
    ]),
    ((__ "Extra Files"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Extra Source Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of additional files to be included in source distributions.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,120)
                            $ emptyParams)
            (extraSrcFiles . pd)
            (\ a b -> b{pd = (pd b){extraSrcFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ,   mkField
            (paraName <<<-  ParaName (__ "Extra Tmp Files")
                $ paraSynopsis <<<- ParaSynopsis
                    (__ "A list of additional files or directories to be removed by setup clean.")
                    $ paraDirection <<<- ParaDirection Vertical
                        $ paraMinSize <<<- ParaMinSize (-1,120)
                            $ emptyParams)
            (extraTmpFiles . pd)
            (\ a b -> b{pd = (pd b){extraTmpFiles = a}})
            (filesEditor (Just fp) FileChooserActionOpen (__ "Select File"))
    ]),
    ((__ "Other"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Build Type")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe executable programs contained in the package")
                        $ paraShadow <<<- ParaShadow ShadowIn
                            $ paraDirection <<<- ParaDirection Vertical
                                $ emptyParams)
            (buildType . pd)
            (\ a b -> b{pd = (pd b){buildType = a}})
            (maybeEditor (buildTypeEditor, emptyParams) True (__ "Specify?"))
    ,   mkField
            (paraName <<<- ParaName (__ "Custom Fields")
                $ paraShadow <<<- ParaShadow ShadowIn
                    $ paraMinSize <<<- ParaMinSize (-1,150)
                        $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            (customFieldsPD . pd)
            (\ a b -> b{pd = (pd b){customFieldsPD = a}})
            (multisetEditor
                (ColumnDescr True [((__ "Name"),\(n,_) -> [cellText := T.pack n])
                                   ,((__ "Value"),\(_,v) -> [cellText := T.pack v])])
                ((pairEditor
                    (stringxEditor (const True),emptyParams)
                    (stringEditor (const True) True,emptyParams)),emptyParams)
            Nothing
            Nothing)
    ]),
    ((__ "Executables"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Executables")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe executable programs contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            exes
            (\ a b -> b{exes = a})
            (executablesEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Tests"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Tests")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe tests contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            tests
            (\ a b -> b{tests = a})
            (testsEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Benchmarks"),VFD emptyParams  [
        mkField
            (paraName <<<- ParaName (__ "Benchmarks")
                $ paraSynopsis <<<- ParaSynopsis
                (__ "Describe tests contained in the package")
                    $ paraDirection <<<- ParaDirection Vertical $ emptyParams)
            bms
            (\ a b -> b{bms = a})
            (benchmarksEditor (Just fp) modules numBuildInfos)
    ]),
    ((__ "Library"), VFD emptyParams [
        mkField
            (paraName <<<- ParaName (__ "Library")
           $ paraSynopsis <<<- ParaSynopsis
             (__ "If the package contains a library, specify the exported modules here")
           $ paraDirection <<<- ParaDirection Vertical
           $ paraShadow <<<- ParaShadow ShadowIn $ emptyParams)
            mbLib
            (\ a b -> b{mbLib = a})
            (maybeEditor (libraryEditor (Just fp) modules numBuildInfos,
                paraName <<<- ParaName (__ "Specify exported modules")
                $ emptyParams) True
                (__ "Does this package contain a library?"))
    ])
    ] ++ extras)