servant-serf 0.2.0 → 0.2.1
raw patch · 2 files changed
+54/−48 lines, 2 filesdep ~attoparsecdep ~basedep ~hpack
Dependency ranges changed: attoparsec, base, hpack, mtl, optparse-applicative, regex-base, text
Files
- app/ApiModule.hs +7/−8
- servant-serf.cabal +47/−40
app/ApiModule.hs view
@@ -31,8 +31,7 @@ : "" : "module " <> getModuleName moduleName <> " (type Route, handler) where" : ""- : "import Servant ((:<|>)((:<|>)))"- : "import qualified GHC.Stack as Stack"+ : "import qualified GHC.Stack" : "import qualified Servant" : "" : fmap renderImport imports@@ -46,15 +45,15 @@ renderImport modu = "import qualified " <> getModuleName modu renderApiType :: [Module] -> Text renderApiType modules = "type Route\n = "- <> T.intercalate "\n :<|> " (fmap (\modul -> getModuleName modul <> ".Route") modules)+ <> T.intercalate "\n Servant.:<|> " (fmap (\modul -> getModuleName modul <> ".Route") modules) renderServerFunction :: [Module] -> Text renderServerFunction modules =- "handler :: Stack.HasCallStack => Servant.ServerT Route _\n"+ "handler :: GHC.Stack.HasCallStack => Servant.ServerT Route _\n" <> "handler\n = " <> handler where handler =- T.intercalate "\n :<|> " (fmap (\modul -> getModuleName modul <> ".handler") modules)+ T.intercalate "\n Servant.:<|> " (fmap (\modul -> getModuleName modul <> ".handler") modules) -- | used to calculate the difference between discovered handler modules -- and imported modules at the call sight of @makeApi@ splice@@ -122,7 +121,7 @@ failModule :: Text -> [Text] -> Text failModule modName errMsgs =- let typeErrors = fmap (\err -> "TypeLits.Text \"" <> err <> "\"") errMsgs+ let typeErrors = fmap (\err -> "GHC.TypeLits.Text \"" <> err <> "\"") errMsgs in T.unlines [ "{-# LANGUAGE ExplicitNamespaces #-}"@@ -131,8 +130,8 @@ , "" , "module " <> modName <> " where" , ""- , "import qualified GHC.TypeLits as TypeLits"+ , "import qualified GHC.TypeLits" , ""- , "handler :: TypeLits.TypeError (" <> T.intercalate " TypeLits.:$$: " typeErrors <> ")"+ , "handler :: GHC.TypeLits.TypeError (" <> T.intercalate " GHC.TypeLits.:$$: " typeErrors <> ")" , "handler = undefined" ]
servant-serf.cabal view
@@ -1,47 +1,54 @@-cabal-version: 1.12---- This file has been generated from package.yaml by hpack version 0.34.4.------ see: https://github.com/sol/hpack+cabal-version: 1.12+name: servant-serf+version: 0.2.1+license: MIT+license-file: LICENSE+maintainer: ACI Learning+homepage: https://github.com/EdutainmentLIVE/servant-serf#readme+bug-reports: https://github.com/EdutainmentLIVE/servant-serf/issues+synopsis: Generates a servant API module+description:+ A preprocessor which will parse a psuedo-haskell module with imports and generate a module with exports a Route type and a handler function -name: servant-serf-version: 0.2.0-synopsis: Generates a servant API module-description: A preprocessor which will parse a psuedo-haskell module with imports and generate a module with exports a Route type and a handler function-category: Code Generation-homepage: https://github.com/EdutainmentLIVE/servant-serf#readme-bug-reports: https://github.com/EdutainmentLIVE/servant-serf/issues-maintainer: ACI Learning-license: MIT-license-file: LICENSE-build-type: Simple-extra-source-files:- README.md+category: Code Generation+build-type: Simple+extra-source-files: README.md source-repository head- type: git- location: https://github.com/EdutainmentLIVE/servant-serf+ type: git+ location: https://github.com/EdutainmentLIVE/servant-serf library- ghc-options: -Weverything -Wno-all-missed-specializations -Wno-implicit-prelude -Wno-missed-specialisations -Wno-missing-deriving-strategies -Wno-missing-export-lists -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-redundant-constraints -Wno-safe -Wno-unsafe- default-language: Haskell2010+ default-language: Haskell2010+ ghc-options:+ -Weverything -Wno-all-missed-specializations -Wno-implicit-prelude+ -Wno-missed-specialisations -Wno-missing-deriving-strategies+ -Wno-missing-export-lists -Wno-missing-exported-signatures+ -Wno-missing-import-lists -Wno-redundant-constraints -Wno-safe+ -Wno-unsafe executable servant-serf- main-is: Main.hs- other-modules:- ApiModule- Options- Regex- hs-source-dirs:- app- ghc-options: -Weverything -Wno-all-missed-specializations -Wno-implicit-prelude -Wno-missed-specialisations -Wno-missing-deriving-strategies -Wno-missing-export-lists -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-redundant-constraints -Wno-safe -Wno-unsafe- build-depends:- attoparsec- , base <=5.2.0.0- , hpack- , mtl- , optparse-applicative- , regex-base- , regex-tdfa >=1.3.1.0- , text- default-language: Haskell2010+ main-is: Main.hs+ hs-source-dirs: app+ other-modules:+ ApiModule+ Options+ Regex++ default-language: Haskell2010+ ghc-options:+ -Weverything -Wno-all-missed-specializations -Wno-implicit-prelude+ -Wno-missed-specialisations -Wno-missing-deriving-strategies+ -Wno-missing-export-lists -Wno-missing-exported-signatures+ -Wno-missing-import-lists -Wno-redundant-constraints -Wno-safe+ -Wno-unsafe++ build-depends:+ 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,+ regex-base >=0.94.0.0,+ regex-tdfa >=1.3.1.0,+ text >=1.2.4.1