Skip to content

Commit

Permalink
Restyled by stylish-haskell (#108)
Browse files Browse the repository at this point in the history
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and z0isch committed Jul 20, 2023
1 parent 6c03c59 commit aafca8f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/Freckle/App/Kafka.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ envKafkaBrokerAddresses = Env.var
(Env.eitherReader readKafkaBrokerAddresses)
"KAFKA_BROKER_ADDRESSES"
mempty

readKafkaBrokerAddresses :: String -> Either String (NonEmpty BrokerAddress)
readKafkaBrokerAddresses t = case (NE.nonEmpty $ T.splitOn "," $ T.pack t) of
Just xs@(x NE.:| _)
Just xs@(x NE.:| _)
| x /= "" -> Right $ BrokerAddress <$> xs
_ -> Left "Broker Address cannot be empty"

Expand All @@ -52,7 +52,7 @@ class HasKafkaProducerPool env where
instance HasKafkaProducerPool site => HasKafkaProducerPool (HandlerData child site) where
kafkaProducerPoolL = envL . siteL . kafkaProducerPoolL

createKafkaProducerPool :: NonEmpty BrokerAddress
createKafkaProducerPool :: NonEmpty BrokerAddress
-> Int
-- ^ The number of stripes (distinct sub-pools) to maintain.
-- The smallest acceptable value is 1.
Expand All @@ -72,7 +72,7 @@ createKafkaProducerPool :: NonEmpty BrokerAddress
-- available.
-> IO (Pool KafkaProducer)
createKafkaProducerPool addresses = Pool.createPool mkProducer closeProducer
where
where
mkProducer =
either throw pure =<< newProducer (brokersList $ toList addresses)
throw err = throwString $ "Failed to open kafka producer: " <> show err
Expand Down Expand Up @@ -127,4 +127,4 @@ produceKeyedOnAsync
-> NonEmpty value
-> (value -> key)
-> m ()
produceKeyedOnAsync prTopic values = void . async . produceKeyedOn prTopic values
produceKeyedOnAsync prTopic values = void . async . produceKeyedOn prTopic values

0 comments on commit aafca8f

Please sign in to comment.