parsonsmatt commented on this pull request.
>
class HasShutdownContext ctx where
shutdownContext :: Lens’ ctx ShutdownContext
+
+instance HasShutdownContext ShutdownContext where
+ shutdownContext = lens identity (_ x -> x)
fun story:
“`haskell
identity :: a -> a
type Lens’ s a = forall f. Functor f => (a -> f a) -> s -> f s
Lens’ x x = forall f. Functor f => (x -> f x) -> (x -> f x)
identity :: forall a f. Functor f => (a -> f a) -> a -> f a
“`
and thus, `shutdownContext = identity` :smile:
> -> Maybe Settings
+ -> Maybe (Word16 -> IO ())
+ — ^ if isJust, use https, isNothing, use raw http
might be a good idea to represent as a new type, eg
“`haskell
data HttpsMode = RunHttpsWith (Word16 -> IO ()) | RunHttp
“`
> where
+ launchServer :: Application -> (Word16, Socket) -> IO ()
+ launchServer app” (port’, socket) = do
+ fromMaybe (const (pure ())) mPortCallback port’
+ maybe runSettingsSocket runTLSSocket mTlsConfig mySettings socket app”
the project used 4 space indentation fwiw. consider using [EditorConfig](http://editorconfig.org/) to have it automatically do this for you :)
This post was last modified on May 7, 2018, 8:01 pm