@@ -2,81 +2,79 @@ module Docs.Search.Config where
22
33import Prelude
44
5−import Docs.Search.Types (PackageName(..))
6−
7−-- | Some magic constants.
8−config ::
9− { version :: String
10− , declIndexDirectory :: String
11− , mkIndexPartLoadPath :: Int -> String
12− , mkIndexPartPath :: Int -> String
13− , moduleIndexPath :: String
14− , moduleIndexLoadPath :: String
15− , metaPath :: String
16− , metaLoadPath :: String
17− , metaItem :: String
18− , groupModulesItem :: String
19− , packageInfoPath :: String
20− , packageInfoLoadPath :: String
21− , mkShapeScriptPath :: String -> String
22− , numberOfIndexParts :: Int
23− , outputDirectory :: String
24− , penalties :: { excessiveConstraint :: Int
25− , generalize :: Int
26− , instantiate :: Int
27− , match :: Int
28− , matchConstraint :: Int
29− , missingConstraint :: Int
30− , rowsMismatch :: Int
31− , typeVars :: Int
32− }
33− , requiredDirectories :: Array String
34− , resultsCount :: Int
35− , typeIndexDirectory :: String
36− , defaultPackageName :: PackageName
5+import Docs.Search.Types
6+
7+version :: String
8+version = "0.0.9"
9+
10+mkShapeScriptPath :: String -> String
11+mkShapeScriptPath shape = "./index/types/" <> shape <> ".js"
12+
13+-- | In how many parts the index should be splitted?
14+numberOfIndexParts :: Int
15+numberOfIndexParts = 50
16+
17+mkIndexPartPath :: Int -> String
18+mkIndexPartPath partId = "html/index/declarations/" <> show partId <> ".js"
19+
20+mkIndexPartLoadPath :: Int -> String
21+mkIndexPartLoadPath partId = "./index/declarations/" <> show partId <> ".js"
22+
23+moduleIndexPath :: String
24+moduleIndexPath = "generated-docs/html/index/modules.js"
25+
26+-- | Used to load mode index to the browser scope.
27+moduleIndexLoadPath :: String
28+moduleIndexLoadPath = "./index/modules.js"
29+
30+typeIndexDirectory :: String
31+typeIndexDirectory = "generated-docs/html/index/types"
32+
33+metaPath :: String
34+metaPath = "generated-docs/html/index/meta.js"
35+
36+metaLoadPath :: URL
37+metaLoadPath = URL "./index/meta.js"
38+
39+metaItem :: String
40+metaItem = "DocsSearchMeta"
41+
42+-- | localStorage key to save sidebar checkbox value to.
43+groupModulesItem :: String
44+groupModulesItem = "PureScriptDocsSearchGroupModules"
45+
46+packageInfoPath :: String
47+packageInfoPath = "generated-docs/html/index/packages.js"
48+
49+packageInfoLoadPath :: String
50+packageInfoLoadPath = "./index/packages.js"
51+
52+-- | How many results to show by default?
53+resultsCount :: Int
54+resultsCount = 25
55+
56+-- | Penalties used to determine how "far" a type query is from a given type.
57+-- See Docs.Search.TypeQuery
58+penalties ::
59+ { excessiveConstraint :: Int
60+ , generalize :: Int
61+ , instantiate :: Int
62+ , match :: Int
63+ , matchConstraint :: Int
64+ , missingConstraint :: Int
65+ , rowsMismatch :: Int
66+ , typeVars :: Int
3767 }
38−config =
39− { version: "0.0.9"
40− , outputDirectory: "output"
41− , requiredDirectories:
42− [ "generated-docs"
43− , "generated-docs/html"
44− , "output"
45− ]
46− -- ^ Directories required by IndexBuilder
47− , declIndexDirectory: "generated-docs/html/index/declarations"
48− , typeIndexDirectory: "generated-docs/html/index/types"
49− , mkShapeScriptPath:
50− \shape -> "./index/types/" <> shape <> ".js"
51− , numberOfIndexParts: 50
52− -- ^ In how many parts the index should be splitted?
53− , mkIndexPartPath:
54− \(partId :: Int) -> "html/index/declarations/" <> show partId <> ".js"
55− , mkIndexPartLoadPath:
56− \(partId :: Int) -> "./index/declarations/" <> show partId <> ".js"
57− , moduleIndexPath: "generated-docs/html/index/modules.js"
58− , moduleIndexLoadPath: "./index/modules.js"
59− -- ^ Used to load mode index to the browser scope.
60− , metaPath: "generated-docs/html/index/meta.js"
61− , metaLoadPath: "./index/meta.js"
62− , metaItem: "DocsSearchMeta"
63− , groupModulesItem: "PureScriptDocsSearchGroupModules"
64− -- ^ localStorage key to save sidebar checkbox value to.
65− , packageInfoPath: "generated-docs/html/index/packages.js"
66− , packageInfoLoadPath: "./index/packages.js"
67− -- ^ Used to load package index to the browser scope.
68− , resultsCount: 25
69− -- ^ How many results to show by default?
70− , penalties: { typeVars: 2
71− , match: 2
72− , matchConstraint: 1
73− , instantiate: 2
74− , generalize: 2
75− , rowsMismatch: 3
76− , missingConstraint: 1
77− , excessiveConstraint: 1
78− }
79− -- ^ Penalties used to determine how "far" a type query is from a given type.
80− -- See Docs.Search.TypeQuery
81− , defaultPackageName: PackageName "<local package>"
68+penalties =
69+ { typeVars: 2
70+ , match: 2
71+ , matchConstraint: 1
72+ , instantiate: 2
73+ , generalize: 2
74+ , rowsMismatch: 3
75+ , missingConstraint: 1
76+ , excessiveConstraint: 1
8277 }
78+
79+defaultPackageName :: PackageName
80+defaultPackageName = PackageName "<local package>"