@@ -9,6 +9,7 @@ import Data.Char
9
9
import Data.Maybe
10
10
import Data.Text (Text )
11
11
import qualified Data.Text as T
12
+ import System.FilePath.Posix ((</>) )
12
13
13
14
type Name = Text
14
15
@@ -75,7 +76,7 @@ parseBench = parseSecMain (Comp Bench) "benchmark"
75
76
parseSecMain :: (Name -> Path -> Component ) -> Text -> Indent -> Parser [Component ]
76
77
parseSecMain c s i = do
77
78
n <- componentHeader i s
78
- p <- pathMain (i + 1 ) [" ./" ] " "
79
+ p <- pathMain (i + 1 ) [" ./" ] " " []
79
80
pure $ map (c n) p
80
81
81
82
parseQuoted :: Parser Text
@@ -105,12 +106,18 @@ parseList i = items <|> (emptyOrComLine >> indent i >> items)
105
106
<|> pure []
106
107
pure $ h : t
107
108
108
- pathMain :: Indent -> [Text ] -> Text -> Parser [Text ]
109
- pathMain i p m =
110
- (hsSourceDir i >>= (\ p' -> pathMain i p' m))
111
- <|> (field i " main-is" (const parseString) >>= pathMain i p)
112
- <|> (skipBlockLine i >> pathMain i p m)
113
- <|> pure (map (<> " /" <> m) p)
109
+ pathMain :: Indent -> [Text ] -> Text -> [Text ] -> Parser [Text ]
110
+ pathMain i p m o =
111
+ (hsSourceDir i >>= (\ p' -> pathMain i p' m o))
112
+ <|> (field i " main-is" (const parseString) >>= flip (pathMain i p) o)
113
+ <|> (field i " other-modules" parseList >>= pathMain i p m)
114
+ <|> (skipBlockLine i >> pathMain i p m o)
115
+ <|> pure (map (<//> m) p <> [p' <//> (o' <> " .hs" ) | p' <- p, o' <- o])
116
+
117
+
118
+ (<//>) :: Text -> Text -> Text
119
+ a <//> b = T. pack (T. unpack a </> T. unpack b)
120
+ infixr 5 <//>
114
121
115
122
parseSec :: Indent -> Text -> (Name -> Path -> Component ) -> Parser [Component ]
116
123
parseSec i compType compCon = do
0 commit comments