@@ -5,7 +5,7 @@
55{-# LANGUAGE DeriveGeneric #-}
66{-# LANGUAGE RankNTypes #-}
77{-# LANGUAGE TypeOperators #-}
8−module Main (main, api, getLink, routesLinks, cliGet, mainMyMonad) where
8+module Main (main, api, getLink, routesLinks, cliGet) where
99
1010import Control.Exception (throwIO)
1111import Data.Proxy (Proxy (..))
@@ -102,6 +102,10 @@ main = do
102102 ("run":_) -> do
103103 putStrLn "Starting cookbook-generic at http://localhost:8000"
104104 run 8000 app
105+ -- see this cookbook below for custom-monad explanation
106+ ("run-custom-monad":_) -> do
107+ putStrLn "Starting cookbook-generic with a custom monad at http://localhost:8000"
108+ run 8000 (appMyMonad AppCustomState)
105109 _ -> putStrLn "To run, pass 'run' argument: cabal new-run cookbook-generic run"
106110```
107111
@@ -134,14 +138,3 @@ nt s x = runReaderT x s
134138
135139appMyMonad :: AppCustomState -> Application
136140appMyMonad state = genericServeT (nt state) recordMyMonad
137−
138−mainMyMonad :: IO ()
139−mainMyMonad = do
140− args <- getArgs
141− case args of
142− ("run":_) -> do
143− putStrLn "Starting cookbook-generic at http://localhost:8000"
144− run 8000 (appMyMonad AppCustomState)
145− _ ->
146− putStrLn "To run, pass 'run' argument: cabal new-run cookbook-generic run"
147−```