servant-serf 0.1.2 → 0.2.0
raw patch · 2 files changed
+48/−54 lines, 2 filesdep ~attoparsecdep ~basedep ~hpack
Dependency ranges changed: attoparsec, base, hpack, mtl, optparse-applicative, regex-base, text
Files
- app/ApiModule.hs +8/−7
- servant-serf.cabal +40/−47
app/ApiModule.hs view
@@ -31,7 +31,8 @@ : "" : "module " <> getModuleName moduleName <> " (type Route, handler) where" : ""- : "import qualified GHC.Stack"+ : "import Servant ((:<|>)((:<|>)))"+ : "import qualified GHC.Stack as Stack" : "import qualified Servant" : "" : fmap renderImport imports@@ -45,15 +46,15 @@ renderImport modu = "import qualified " <> getModuleName modu renderApiType :: [Module] -> Text renderApiType modules = "type Route\n = "- <> T.intercalate "\n Servant.:<|> " (fmap (\modul -> getModuleName modul <> ".Route") modules)+ <> T.intercalate "\n :<|> " (fmap (\modul -> getModuleName modul <> ".Route") modules) renderServerFunction :: [Module] -> Text renderServerFunction modules =- "handler :: GHC.Stack.HasCallStack => Servant.ServerT Route _\n"+ "handler :: Stack.HasCallStack => Servant.ServerT Route _\n" <> "handler\n = " <> handler where handler =- T.intercalate "\n Servant.:<|> " (fmap (\modul -> getModuleName modul <> ".handler") modules)+ T.intercalate "\n :<|> " (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@@ -121,7 +122,7 @@ failModule :: Text -> [Text] -> Text failModule modName errMsgs =- let typeErrors = fmap (\err -> "GHC.TypeLits.Text \"" <> err <> "\"") errMsgs+ let typeErrors = fmap (\err -> "TypeLits.Text \"" <> err <> "\"") errMsgs in T.unlines [ "{-# LANGUAGE ExplicitNamespaces #-}"@@ -130,8 +131,8 @@ , "" , "module " <> modName <> " where" , ""- , "import qualified GHC.TypeLits"+ , "import qualified GHC.TypeLits as TypeLits" , ""- , "handler :: GHC.TypeLits.TypeError (" <> T.intercalate " GHC.TypeLits.:$$: " typeErrors <> ")"+ , "handler :: TypeLits.TypeError (" <> T.intercalate " TypeLits.:$$: " typeErrors <> ")" , "handler = undefined" ]
servant-serf.cabal view
@@ -1,54 +1,47 @@-cabal-version: 1.12-name: servant-serf-version: 0.1.2-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+cabal-version: 1.12 -category: Code Generation-build-type: Simple-extra-source-files: README.md+-- This file has been generated from package.yaml by hpack version 0.34.4.+--+-- see: https://github.com/sol/hpack +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+ source-repository head- type: git- location: https://github.com/EdutainmentLIVE/servant-serf+ type: git+ location: https://github.com/EdutainmentLIVE/servant-serf library- 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+ 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 executable servant-serf- 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+ 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