mirror of
https://github.com/Avi-D-coder/implicit-hie.git
synced 2024-11-26 11:25:24 +03:00
Add benchmark section
This commit is contained in:
parent
706c15c262
commit
bacaa2350e
@ -18,7 +18,11 @@ type Indent = Int
|
||||
data Package = Package Name [Component]
|
||||
deriving (Show, Eq, Ord)
|
||||
|
||||
data Component = Lib Name Path | Exe Name Path | Test Name Path
|
||||
data Component
|
||||
= Lib Name Path
|
||||
| Exe Name Path
|
||||
| Test Name Path
|
||||
| Bench Name Path
|
||||
deriving (Show, Eq, Ord)
|
||||
|
||||
parsePackage' :: Text -> Either String Package
|
||||
@ -61,9 +65,15 @@ parseTestSuite :: Indent -> Parser Component
|
||||
parseTestSuite i = parseSec i "test-suite" Test
|
||||
|
||||
parseExe :: Indent -> Parser Component
|
||||
parseExe i = do
|
||||
n <- componentHeader i "executable"
|
||||
Exe n <$> pathMain (i + 1) "." ""
|
||||
parseExe = parseSecMain Exe "executable"
|
||||
|
||||
parseBench :: Indent -> Parser Component
|
||||
parseBench = parseSecMain Bench "benchmark"
|
||||
|
||||
parseSecMain :: (Name -> Path -> Component) -> Text -> Indent -> Parser Component
|
||||
parseSecMain c s i = do
|
||||
n <- componentHeader i s
|
||||
c n <$> pathMain (i + 1) "." ""
|
||||
|
||||
parseQuoted :: Parser Text
|
||||
parseQuoted = do
|
||||
|
@ -4,7 +4,7 @@ module Hie.Yaml
|
||||
( cabalHieYaml,
|
||||
stackHieYaml,
|
||||
cabalComponent,
|
||||
stackComponent
|
||||
stackComponent,
|
||||
)
|
||||
where
|
||||
|
||||
@ -32,12 +32,14 @@ cabalComponent :: Name -> Component -> (FilePath, String)
|
||||
cabalComponent n (Lib "" p) = (T.unpack p, T.unpack $ "lib:" <> n)
|
||||
cabalComponent n (Lib cn p) = (T.unpack p, T.unpack $ "lib:" <> n <> ":" <> cn)
|
||||
cabalComponent n (Exe cn p) = (T.unpack p, T.unpack $ n <> ":exe:" <> cn)
|
||||
cabalComponent n (Bench cn p) = (T.unpack p, T.unpack $ n <> ":exe:" <> cn)
|
||||
cabalComponent n (Test cn p) = (T.unpack p, T.unpack $ n <> ":test:" <> cn)
|
||||
|
||||
stackComponent :: Name -> Component -> (FilePath, String)
|
||||
stackComponent n (Lib "" p) = (T.unpack p, T.unpack $ n <> ":lib")
|
||||
stackComponent n (Lib cn p) = (T.unpack p, T.unpack $ n <> ":lib:" <> cn)
|
||||
stackComponent n (Exe cn p) = (T.unpack p, T.unpack $ n <> ":exe:" <> cn)
|
||||
stackComponent n (Bench cn p) = (T.unpack p, T.unpack $ n <> ":exe:" <> cn)
|
||||
stackComponent n (Test cn p) = (T.unpack p, T.unpack $ n <> ":test:" <> cn)
|
||||
|
||||
fmtComponent :: (FilePath, String) -> String
|
||||
|
Loading…
Reference in New Issue
Block a user