@@ -26,8 +26,8 @@ import qualified Reporting.Task as Task
29−compile :: Project -> Module.Interfaces -> Dict Plan.Info -> Task.Task (Dict Answer)
29+compile :: Project -> Maybe FilePath -> Module.Interfaces -> Dict Plan.Info -> Task.Task (Dict Answer)
30−compile project ifaces modules =
30+compile project maybeDocsPath ifaces modules =
31 do Task.report (Progress.CompileStart (Map.size modules))
31 do Task.report (Progress.CompileStart (Map.size modules))
33 tell <- Task.getReporter
33 tell <- Task.getReporter
@@ -35,7 +35,7 @@ compile project ifaces modules =
35 answers <- liftIO $
35 answers <- liftIO $
36 do mvar <- newEmptyMVar
36 do mvar <- newEmptyMVar
37 iMVar <- newMVar ifaces
37 iMVar <- newMVar ifaces
38− answerMVars <- Map.traverseWithKey (compileModule tell project mvar iMVar) modules
38+ answerMVars <- Map.traverseWithKey (compileModule tell project maybeDocsPath mvar iMVar) modules
39 putMVar mvar answerMVars
39 putMVar mvar answerMVars
40 traverse readMVar answerMVars
40 traverse readMVar answerMVars
@@ -64,12 +64,13 @@ type Dict a = Map.Map Module.Raw a
64compileModule
64compileModule
65 :: (Progress.Progress -> IO ())
65 :: (Progress.Progress -> IO ())
66 -> Project
66 -> Project
67 -> MVar (Dict (MVar Answer))
68 -> MVar (Dict (MVar Answer))
68 -> MVar Module.Interfaces
69 -> MVar Module.Interfaces
69 -> Module.Raw
70 -> Module.Raw
70 -> Plan.Info
71 -> Plan.Info
71 -> IO (MVar Answer)
72 -> IO (MVar Answer)
72−compileModule tell project answersMVar ifacesMVar name info =
73+compileModule tell project maybeDocsPath answersMVar ifacesMVar name info =
73 do mvar <- newEmptyMVar
74 do mvar <- newEmptyMVar
75 void $ forkIO $
76 void $ forkIO $
@@ -80,10 +81,10 @@ compileModule tell project answersMVar ifacesMVar name info =
81 do tell (Progress.CompileFileStart name)
82 do tell (Progress.CompileFileStart name)
82 let pkg = Project.getName project
83 let pkg = Project.getName project
83− let isExposed = Project.isPackageRoot name project
84+ let docs = toDocsFlag name project maybeDocsPath
84 let imports = makeImports project info
85 let imports = makeImports project info
85 ifaces <- readMVar ifacesMVar
86 ifaces <- readMVar ifacesMVar
86− let context = Compiler.Context pkg isExposed imports ifaces
87+ let context = Compiler.Context pkg docs imports ifaces
87 let source = Plan._src info
88 let source = Plan._src info
88 case Compiler.compile context source of
89 case Compiler.compile context source of
89 (_warnings, Left errors) ->
90 (_warnings, Left errors) ->
@@ -103,6 +104,38 @@ compileModule tell project answersMVar ifacesMVar name info =
110+toDocsFlag :: Module.Raw -> Project -> Maybe FilePath -> Compiler.DocsFlag
111+toDocsFlag name project maybeDocsPath =
112+ case maybeDocsPath of
122+ if isExposed name (Project._pkg_exposed info) then
128+isExposed :: Module.Raw -> Project.Exposed -> Bool
129+isExposed name exposed =
131+ Project.ExposedList modules ->
134+ Project.ExposedDict chunks ->
135+ elem name (concatMap snd chunks)
106-- IMPORTS
139-- IMPORTS