mirror of
https://github.com/Avi-D-coder/implicit-hie.git
synced 2024-11-30 00:33:29 +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]
|
data Package = Package Name [Component]
|
||||||
deriving (Show, Eq, Ord)
|
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)
|
deriving (Show, Eq, Ord)
|
||||||
|
|
||||||
parsePackage' :: Text -> Either String Package
|
parsePackage' :: Text -> Either String Package
|
||||||
@ -61,9 +65,15 @@ parseTestSuite :: Indent -> Parser Component
|
|||||||
parseTestSuite i = parseSec i "test-suite" Test
|
parseTestSuite i = parseSec i "test-suite" Test
|
||||||
|
|
||||||
parseExe :: Indent -> Parser Component
|
parseExe :: Indent -> Parser Component
|
||||||
parseExe i = do
|
parseExe = parseSecMain Exe "executable"
|
||||||
n <- componentHeader i "executable"
|
|
||||||
Exe n <$> pathMain (i + 1) "." ""
|
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 :: Parser Text
|
||||||
parseQuoted = do
|
parseQuoted = do
|
||||||
|
@ -4,7 +4,7 @@ module Hie.Yaml
|
|||||||
( cabalHieYaml,
|
( cabalHieYaml,
|
||||||
stackHieYaml,
|
stackHieYaml,
|
||||||
cabalComponent,
|
cabalComponent,
|
||||||
stackComponent
|
stackComponent,
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
@ -32,12 +32,14 @@ cabalComponent :: Name -> Component -> (FilePath, String)
|
|||||||
cabalComponent n (Lib "" p) = (T.unpack p, T.unpack $ "lib:" <> n)
|
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 (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 (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)
|
cabalComponent n (Test cn p) = (T.unpack p, T.unpack $ n <> ":test:" <> cn)
|
||||||
|
|
||||||
stackComponent :: Name -> Component -> (FilePath, String)
|
stackComponent :: Name -> Component -> (FilePath, String)
|
||||||
stackComponent n (Lib "" p) = (T.unpack p, T.unpack $ n <> ":lib")
|
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 (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 (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)
|
stackComponent n (Test cn p) = (T.unpack p, T.unpack $ n <> ":test:" <> cn)
|
||||||
|
|
||||||
fmtComponent :: (FilePath, String) -> String
|
fmtComponent :: (FilePath, String) -> String
|
||||||
|
Loading…
Reference in New Issue
Block a user