Skip to content

Commit

Permalink
Update to fix fourmolu
Browse files Browse the repository at this point in the history
  • Loading branch information
onslaughtq committed Jul 19, 2023
1 parent d6336c2 commit 85a5fcf
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions beeline-examples/src/Beeline/Examples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ shipmentIdParam :: R.ParameterDefinition ShipmentId
shipmentIdParam =
R.coerceParam (R.intParam "shipmentId")

shipmentRouter :: (R.Router r) => r ShipmentRoutes
shipmentRouter :: R.Router r => r ShipmentRoutes
shipmentRouter =
R.routeList $
R.get (R.make ListShipments)
Expand All @@ -63,7 +63,7 @@ shipmentRouter =
/: (R.make ShipmentItemRoute /- "items" /> R.Subrouter itemRouter shipmentItemRoute)
/: R.emptyRoutes

shipmentRouterWithoutOperators :: (R.Router r) => r ShipmentRoutes
shipmentRouterWithoutOperators :: R.Router r => r ShipmentRoutes
shipmentRouterWithoutOperators =
R.routeList
. R.addRoute (R.get (R.make ListShipments))
Expand Down Expand Up @@ -109,7 +109,7 @@ itemIdParam :: R.ParameterDefinition ItemId
itemIdParam =
R.coerceParam (R.intParam "itemId")

itemRouter :: (R.Router r) => r ItemRoutes
itemRouter :: R.Router r => r ItemRoutes
itemRouter =
R.routeList $
R.get (R.make ListItems)
Expand Down
6 changes: 3 additions & 3 deletions beeline-http-client/src/Beeline/HTTP/Client/HTTPRequest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ defaultRequest =
}

httpRequestThrow ::
(Exc.Exception err) =>
Exc.Exception err =>
Operation err route query headers requestBody response ->
Request route query headers requestBody ->
HTTP.Manager ->
Expand All @@ -80,7 +80,7 @@ httpRequestThrow =
httpRequestUsing HTTP.withResponse throwStatusAndDecodingErrors

throwStatusAndDecodingErrors ::
(Exc.Exception err) =>
Exc.Exception err =>
StatusResult HTTP.BodyReader err response ->
IO response
throwStatusAndDecodingErrors statusResult =
Expand Down Expand Up @@ -197,7 +197,7 @@ buildHTTPRequest operation request =
}

handleHTTPResponse ::
(Foldable t) =>
Foldable t =>
HTTP.Request ->
t (StatusRange, ResponseBodySchema err response) ->
HTTP.Response HTTP.BodyReader ->
Expand Down
10 changes: 5 additions & 5 deletions beeline-http-client/src/Beeline/HTTP/Client/Operation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ noRequestBody =
}

requestBody ::
(ContentTypeEncoder coder) => coder -> EncodeSchema coder a -> RequestBodySchema a
ContentTypeEncoder coder => coder -> EncodeSchema coder a -> RequestBodySchema a
requestBody coder encoder =
RequestBodySchema
{ requestBodyContentType = Just (toRequestContentType coder encoder)
Expand Down Expand Up @@ -141,7 +141,7 @@ noResponseBody =
}

responseBody ::
(ContentTypeDecoder coder) =>
ContentTypeDecoder coder =>
coder ->
DecodeSchema coder a ->
ResponseBodySchema (DecodingError coder) a
Expand All @@ -154,21 +154,21 @@ responseBody coder decoder =
data NoPathParams = NoPathParams
deriving (Show, Eq)

noPathParams :: (R.Router r) => r NoPathParams
noPathParams :: R.Router r => r NoPathParams
noPathParams =
R.get (R.make NoPathParams)

data NoQueryParams = NoQueryParams
deriving (Show, Eq)

noQueryParams :: (ParameterCollectionSchema q) => q NoQueryParams NoQueryParams
noQueryParams :: ParameterCollectionSchema q => q NoQueryParams NoQueryParams
noQueryParams =
makeParams NoQueryParams

data NoHeaderParams = NoHeaderParams
deriving (Show, Eq)

noHeaderParams :: (ParameterCollectionSchema q) => q NoHeaderParams NoHeaderParams
noHeaderParams :: ParameterCollectionSchema q => q NoHeaderParams NoHeaderParams
noHeaderParams =
makeParams NoHeaderParams

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ParameterCollectionSchema q where
ParameterCollectionItem q query (NEL.NonEmpty param)

(?+) ::
(ParameterCollectionSchema q) =>
ParameterCollectionSchema q =>
q query (param -> c) ->
ParameterCollectionItem q query param ->
q query c
Expand Down Expand Up @@ -378,7 +378,7 @@ decodeListParamBytes paramDef mbValues =
Just values -> fmap DList.toList (traverse (decodeParamBytes paramDef) values)

lookupSingleValue ::
(Ord key) =>
Ord key =>
T.Text ->
key ->
Map.Map key (DList.DList BS.ByteString) ->
Expand Down
8 changes: 4 additions & 4 deletions beeline-http-client/test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ data TestQueryParams = TestQueryParams
}
deriving (Show, Eq)

testQueryParamSchema :: (BHC.ParameterCollectionSchema q) => q TestQueryParams TestQueryParams
testQueryParamSchema :: BHC.ParameterCollectionSchema q => q TestQueryParams TestQueryParams
testQueryParamSchema =
BHC.makeParams TestQueryParams
?+ BHC.required queryParam1 (R.textParam "param1")
Expand Down Expand Up @@ -506,7 +506,7 @@ prop_httpPostQueryParams =
response === BHC.NoResponseBody

requiredFooBarQuery ::
(BHC.ParameterCollectionSchema r) =>
BHC.ParameterCollectionSchema r =>
r (T.Text, Int) (T.Text, Int)
requiredFooBarQuery =
BHC.makeParams (,)
Expand Down Expand Up @@ -536,7 +536,7 @@ prop_queryParamsRequired =
Right (foo, bar) === roundTrippedValue

optionalFooBarQuery ::
(BHC.ParameterCollectionSchema r) =>
BHC.ParameterCollectionSchema r =>
r (Maybe T.Text, Maybe Int) (Maybe T.Text, Maybe Int)
optionalFooBarQuery =
BHC.makeParams (,)
Expand Down Expand Up @@ -567,7 +567,7 @@ prop_queryParamsOptional =
Right (foo, bar) === roundTrippedValue

explodedArrayFooBarQuery ::
(BHC.ParameterCollectionSchema r) =>
BHC.ParameterCollectionSchema r =>
r ([T.Text], [Int]) ([T.Text], [Int])
explodedArrayFooBarQuery =
BHC.makeParams (,)
Expand Down
4 changes: 2 additions & 2 deletions beeline-routing/src/Beeline/Routing/ParameterDefinition.hs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ boundedEnumParam toText =
in
convertParam parseEnum toText . textParam

integralParam :: (Integral n) => Text -> ParameterDefinition n
integralParam :: Integral n => Text -> ParameterDefinition n
integralParam name =
parsedParam
name
(Atto.signed Atto.decimal)
(LT.toStrict . LTB.toLazyText . LTBI.decimal)

coerceParam :: (Coercible a b) => ParameterDefinition b -> ParameterDefinition a
coerceParam :: Coercible a b => ParameterDefinition b -> ParameterDefinition a
coerceParam =
convertParam (Right . coerce) coerce

Expand Down
28 changes: 14 additions & 14 deletions beeline-routing/src/Beeline/Routing/Router.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,26 @@ class Router r where
subrouter ::
Builder r route (subrouter -> route) -> Subrouter r route subrouter -> r route

routeList :: (KnownLength types) => RouteList r types -> r (Union types)
routeList :: KnownLength types => RouteList r types -> r (Union types)
addRoute :: r a -> RouteList r rest -> RouteList r (a : rest)
emptyRoutes :: RouteList r '[]

(/-) ::
(Router r) =>
Router r =>
Builder r route a ->
Text ->
Builder r route a
(/-) = piece

(/+) ::
(Router r) =>
Router r =>
Builder r route (a -> b) ->
Param route a ->
Builder r route b
(/+) = param

(/>) ::
(Router r) =>
Router r =>
Builder r route (subroute -> route) ->
Subrouter r route subroute ->
r route
Expand All @@ -87,34 +87,34 @@ infixl 9 />
infixl 9 /-
infixl 9 /+

(/:) :: (Router r) => r a -> RouteList r rest -> RouteList r (a : rest)
(/:) :: Router r => r a -> RouteList r rest -> RouteList r (a : rest)
(/:) = addRoute

infixr 9 /:

get :: (Router r) => Builder r route route -> r route
get :: Router r => Builder r route route -> r route
get = method HTTP.GET

post :: (Router r) => Builder r route route -> r route
post :: Router r => Builder r route route -> r route
post = method HTTP.POST

head :: (Router r) => Builder r route route -> r route
head :: Router r => Builder r route route -> r route
head = method HTTP.HEAD

put :: (Router r) => Builder r route route -> r route
put :: Router r => Builder r route route -> r route
put = method HTTP.PUT

delete :: (Router r) => Builder r route route -> r route
delete :: Router r => Builder r route route -> r route
delete = method HTTP.DELETE

trace :: (Router r) => Builder r route route -> r route
trace :: Router r => Builder r route route -> r route
trace = method HTTP.TRACE

connect :: (Router r) => Builder r route route -> r route
connect :: Router r => Builder r route route -> r route
connect = method HTTP.CONNECT

options :: (Router r) => Builder r route route -> r route
options :: Router r => Builder r route route -> r route
options = method HTTP.OPTIONS

patch :: (Router r) => Builder r route route -> r route
patch :: Router r => Builder r route route -> r route
patch = method HTTP.PATCH
2 changes: 1 addition & 1 deletion beeline-routing/test/Fixtures/FooBarBaz.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ handleFooBarBaz foo bar baz =
Shrubbery.branch baz $
Shrubbery.branchEnd

fooBarBazRouter :: (R.Router r) => r FooBarBaz
fooBarBazRouter :: R.Router r => r FooBarBaz
fooBarBazRouter =
R.routeList $
R.get (R.make Foo /- "foo")
Expand Down
2 changes: 1 addition & 1 deletion beeline-routing/test/Fixtures/Subrouter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ rightSubroutePath :: T.Text
rightSubroutePath =
"right"

subrouter :: (R.Router r) => r Subroutes
subrouter :: R.Router r => r Subroutes
subrouter =
R.routeList $
( R.make LeftSubroute
Expand Down
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
dev:
image: ghcr.io/flipstone/haskell-tools:debian-unstable-ghc-9.4.5-2023-07-17-f86296e
image: ghcr.io/flipstone/haskell-tools:debian-unstable-ghc-9.4.5-2023-07-18-1d8bf61
volumes:
- .:${PROJECT_DIR}
- flipstone_stack_root:/stack-root
Expand Down
2 changes: 1 addition & 1 deletion fourmolu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ let-style: newline
in-style: left-align
unicode: never # default
respectful: true # default

single-constraint-parens: never

0 comments on commit 85a5fcf

Please sign in to comment.