servant-serf 0.1.0 → 0.1.1
raw patch · 4 files changed
+26/−25 lines, 4 filesdep ~attoparsecdep ~basedep ~hpacknew-uploader
Dependency ranges changed: attoparsec, base, hpack, text
Files
- app/ApiModule.hs +14/−13
- app/Main.hs +1/−2
- app/Options.hs +6/−5
- servant-serf.cabal +5/−5
app/ApiModule.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE OverloadedStrings #-} module ApiModule where@@ -13,6 +12,8 @@ import Control.Applicative (some, Alternative(..)) import Control.Monad (void) +import Options (Config(..))+ newtype Module = Module { getModuleName :: Text } data ApiModule = ApiModule@@ -20,10 +21,10 @@ , imports :: [Module] } -renderApiModule :: ApiModule -> Text-renderApiModule ApiModule { moduleName, imports } =- (T.unlines- $ "{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}"+renderApiModule :: Config -> ApiModule -> Text+renderApiModule config ApiModule { moduleName, imports } =+ ( T.unlines+ $ "{-# OPTIONS_GHC -fno-warn-partial-type-signatures " <> ghcOptions config <> " #-}" : "{-# LANGUAGE PartialTypeSignatures #-}" : "{-# LANGUAGE ExplicitNamespaces #-}" : "{-# LANGUAGE TypeOperators #-}"@@ -35,11 +36,11 @@ : "import qualified Servant" : "" : fmap renderImport imports- )- <> "\n"- <> renderApiType imports- <> "\n\n"- <> renderServerFunction imports+ )+ <> "\n"+ <> renderApiType imports+ <> "\n\n"+ <> renderServerFunction imports where renderImport :: Module -> Text renderImport modu = "import qualified " <> getModuleName modu@@ -90,15 +91,15 @@ {-# INLINEABLE skipLineComment #-} comment :: Atto.Parser ()-comment = +comment = skipBlockComment "{-" "-}" <|> skipLineComment "--" -spaceConsumer :: Atto.Parser () +spaceConsumer :: Atto.Parser () spaceConsumer = Atto.skipMany singleSpaceConsumer where singleSpaceConsumer =- (Atto.skipMany1 $ Atto.skip isSpace) + (Atto.skipMany1 $ Atto.skip isSpace) <|> comment parserModule :: Atto.Parser Module
app/Main.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE OverloadedStrings #-}@@ -43,7 +42,7 @@ let outputModule = case mException of Left exception -> renderException origInputFile moduleName exception- Right () -> renderApiModule apiModule+ Right () -> renderApiModule config apiModule T.writeFile output outputModule mainPP :: ApiModule -> Config -> Preprocessor ()
app/Options.hs view
@@ -1,12 +1,8 @@-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TemplateHaskell #-} -module Options +module Options ( Options(..) , options , Options.Applicative.execParser@@ -56,8 +52,13 @@ ( long "is-handler-module" <> short 'm' )+ <*> option str+ ( long "ghc-options"+ <> value ""+ ) data Config = Config { packageName :: Text , isHandlerModule :: Pattern'+ , ghcOptions :: Text }
servant-serf.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: servant-serf-version: 0.1.0+version: 0.1.1 license: MIT license-file: LICENSE maintainer: Zachary Churchill <zachary@itpro.tv>@@ -40,15 +40,15 @@ -Wno-unsafe build-depends:- attoparsec >=0.13.2.4,- base >=4.13.0.0 && <=5.2.0.0,- hpack >=0.34.2,+ attoparsec >=0.13.2.5,+ base >=4.14.1.0 && <=5.2.0.0,+ hpack >=0.34.4, mtl >=2.2.2, optparse-applicative >=0.15.1.0, parser-combinators >=1.2.1, regex-base >=0.94.0.0, regex-tdfa >=1.3.1.0,- text >=1.2.4.0+ text >=1.2.4.1 if False other-modules: Paths_servant_serf