packages feed

mig 0.2.0.0 → 0.2.0.1

raw patch · 7 files changed

+32/−24 lines, 7 files

Files

mig.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:               mig-version:            0.2.0.0+version:            0.2.0.1 synopsis:           Build lightweight and composable servers description:        The Core for the mig server library.                     With library mig we can build lightweight and composable servers.@@ -68,6 +68,7 @@       DerivingStrategies       StrictData       AllowAmbiguousTypes+      DataKinds   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -Wunused-packages   build-depends:       aeson@@ -114,6 +115,7 @@       DerivingStrategies       StrictData       AllowAmbiguousTypes+      DataKinds   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -Wunused-packages -threaded -rtsopts -with-rtsopts=-N   build-depends:       aeson
src/Mig/Core/Api/NormalForm/TreeApi.hs view
@@ -20,10 +20,11 @@  type CaptureMap = Map Text Text --- | This form of API encodes path switch points as Map's so--- it does not retraverse the routes and can find the right--- branch on switch. In the plain api it tries the routes one by one--- until it finds the right one.+{-| This form of API encodes path switch points as Map's so+it does not retraverse the routes and can find the right+branch on switch. In the plain api it tries the routes one by one+until it finds the right one.+-} data TreeApi a   = WithStaticPath [Text] (TreeApi a)   | WithCapturePath [Text] (TreeApi a)
src/Mig/Core/Class/Route.hs view
@@ -1,7 +1,8 @@ {-# LANGUAGE UndecidableInstances #-} --- | Creation of routes from functions. A route is a handler function--- for single path of the server.+{-| Creation of routes from functions. A route is a handler function+for single path of the server.+-} module Mig.Core.Class.Route (   Route (..),   ToRoute (..),
src/Mig/Core/Server.hs view
@@ -103,10 +103,11 @@ mapResponse :: (Functor m) => (Response -> Response) -> Server m -> Server m mapResponse f = mapServerFun $ \fun -> fmap (fmap f) . fun --- | API route finder strategy. The API can be transformed to some normal form--- for faster route lookup. So far we have two normal forms.--- One is plain Api type as it is. And another one is tree-structure--- where path switches are encoded with Map's.+{-| API route finder strategy. The API can be transformed to some normal form+for faster route lookup. So far we have two normal forms.+One is plain Api type as it is. And another one is tree-structure+where path switches are encoded with Map's.+-} data FindRoute normalForm m = FindRoute   { toNormalForm :: Api (Route m) -> normalForm (Route m)   , getPath :: [Text] -> normalForm (Route m) -> Maybe (Route m, Api.CaptureMap)
src/Mig/Core/Server/Cache.hs view
@@ -21,32 +21,38 @@ -- | Cache config data CacheConfig = CacheConfig   { size :: Int-    -- ^ how many items are allowed in the cache+  -- ^ how many items are allowed in the cache   , cacheFilter :: CacheKey -> Bool-    -- ^ which route to cache+  -- ^ which route to cache   }  -- | Route key identidfies the single item for caching data CacheKey = CacheKey-  { inputType :: ByteString  -- ^ value of "Content-Type" header-  , outputType :: ByteString -- ^ value of "Accept" header-  , method :: Method -- ^ http method-  , path :: [Text] -- ^ path to route (includes inlined captures)+  { inputType :: ByteString+  -- ^ value of "Content-Type" header+  , outputType :: ByteString+  -- ^ value of "Accept" header+  , method :: Method+  -- ^ http method+  , path :: [Text]+  -- ^ path to route (includes inlined captures)   }   deriving (Show, Eq, Ord)  -- | Cache value data CacheValue m = CacheValue-  { captures :: CaptureMap -- ^ extracted capture map from the path-  , route :: Route m -- ^ route handler+  { captures :: CaptureMap+  -- ^ extracted capture map from the path+  , route :: Route m+  -- ^ route handler   }  -- | Route cache data RouteCache m = RouteCache   { cacheFilter :: CacheKey -> Bool-    -- ^ which route to cache (if True the route is cached)+  -- ^ which route to cache (if True the route is cached)   , cache :: AtomicLRU CacheKey (CacheValue m)-    -- ^ cache map+  -- ^ cache map   }  -- | Allocates new cache
test/Test/Server/Counter.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE DataKinds #-}- -- | Test case for ReaderT based server module Test.Server.Counter (spec) where 
test/Test/Server/RouteArgs.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-}  -- | Tests for various inputs for requests