Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Renamed Runner to Initializer and made the type of Initializer a bit …

…cleaner
  • Loading branch information...
commit b036f7fc05ede0b99efe5df7d444131f46eb3e63 1 parent f67ef44
Shane authored
2  snap-extensions.cabal
@@ -47,7 +47,7 @@ Library
47 47 monads-fd,
48 48 HDBC >= 2,
49 49 heist >= 0.2,
50   - hexpat >= 0.16 && < 0.17,
  50 + hexpat >= 0.16,
51 51 process,
52 52 snap >= 0.3 && < 0.4,
53 53 snap-core >= 0.3 && < 0.4,
156 src/Snap/Extension.hs
@@ -3,11 +3,11 @@
3 3
4 4 module Snap.Extension
5 5 ( SnapExtend
6   - , Runner
7   - , RunnerState(..)
8   - , runRunner
9   - , runRunnerHint
10   - , mkRunner
  6 + , Initializer
  7 + , InitializerState(..)
  8 + , runInitializer
  9 + , runInitializerHint
  10 + , mkInitializer
11 11 , defaultReloadHandler
12 12 , nullReloadHandler
13 13 ) where
@@ -48,16 +48,36 @@ newtype SnapExtend s a = SnapExtend (ReaderT s Snap a)
48 48
49 49
50 50 ------------------------------------------------------------------------------
51   --- | The 'Runner' monad. This can be used for constructing values which also
52   --- have cleanup\/destroy and reload functions.
53   -newtype Runner s = Runner
54   - (Bool -> IO (Either s (s, IO (), IO [(ByteString, Maybe ByteString)])))
  51 +-- | The 'SCR' datatype is used internally by the 'Initializer' monad to store
  52 +-- the application's state, cleanup actions and reload actions.
  53 +data SCR s = SCR
  54 + { _state :: s
  55 + -- ^ The internal state of the application's Snap Extensions.
  56 + , _cleanup :: IO ()
  57 + -- ^ IO action which when run will cleanup the application's state,
  58 + -- e.g., closing open connections.
  59 + , _reload :: IO [(ByteString, Maybe ByteString)]
  60 + -- ^ IO action which when run will reload the application's state, e.g.,
  61 + -- refreshing any cached values stored in the state.
  62 + --
  63 + -- It returns a list of tuples whose \"keys\" are the names of the Snap
  64 + -- Extensions which were reloaded and whose \"values\" are @Nothing@
  65 + -- when run successfully and @Just x@ on failure, where @x@ is an error
  66 + -- message.
  67 + }
55 68
56 69
57 70 ------------------------------------------------------------------------------
58   --- | Values of types which are instances of 'RunnerState' have
  71 +-- | The 'Initializer' monad. The code that initialises your application's
  72 +-- state is written in the 'Initializer' monad. It's used for constructing
  73 +-- values which have cleanup\/destroy and reload actions associated with them.
  74 +newtype Initializer s = Initializer (Bool -> IO (Either s (SCR s)))
  75 +
  76 +
  77 +------------------------------------------------------------------------------
  78 +-- | Values of types which are instances of 'InitializerState' have
59 79 -- cleanup\/destroy and reload actions associated with them.
60   -class RunnerState s where
  80 +class InitializerState s where
61 81 extensionId :: s -> ByteString
62 82 mkCleanup :: s -> IO ()
63 83 mkReload :: s -> IO ()
@@ -65,17 +85,18 @@ class RunnerState s where
65 85
66 86 ------------------------------------------------------------------------------
67 87 -- | Although it has the same type signature, this is not the same as 'return'
68   --- in the 'Runner' monad. Return simply lifts a value into the 'Runner' monad,
69   --- but this lifts the value and its destroy\/reload actions. Use this when
70   --- making your own 'Runner' actions.
71   -mkRunner :: RunnerState s => s -> Runner s
72   -mkRunner s = Runner $ \v -> setup v $ Right (s, cleanup v, reload v)
  88 +-- in the 'Initializer' monad. Return simply lifts a value into the
  89 +-- 'Initializer' monad, but this lifts the value and its destroy\/reload
  90 +-- actions. Use this when making your own 'Initializer' actions.
  91 +mkInitializer :: InitializerState s => s -> Initializer s
  92 +mkInitializer s = Initializer $ \v -> setup v $ Right $ mkSCR v
73 93 where
74 94 handler :: SomeException -> IO (Maybe ByteString)
75 95 handler e = return $ Just $ U.fromString $ show e
76 96 maybeCatch m = (m >> return Nothing) `catch` handler
77 97 maybeToMsg = maybe " done." $ const " failed."
78 98 name = U.toString $ extensionId s
  99 + mkSCR v = SCR s (cleanup v) (reload v)
79 100 cleanup v = do
80 101 when v $ hPutStr stderr $ "Cleaning up " ++ name ++ "..."
81 102 m <- maybeCatch $ mkCleanup s
@@ -91,81 +112,82 @@ mkRunner s = Runner $ \v -> setup v $ Right (s, cleanup v, reload v)
91 112
92 113
93 114 ------------------------------------------------------------------------------
94   --- | Given the runner for your application's state, and a value in the monad
95   --- formed by 'SnapExtend' wrapped it, this returns a 'Snap' action, a cleanup
96   --- action and a reload action.
97   -runRunner :: Bool
98   - -- ^ Verbosity; info is printed to 'stderr' when this is 'True'
99   - -> Runner s
100   - -- ^ The Runner value
101   - -> SnapExtend s ()
102   - -- ^ An action in your application's monad
103   - -> IO (Snap (), IO (), IO [(ByteString, Maybe ByteString)])
104   - -- ^ This is documented thoroughly in the README
105   -runRunner v (Runner r) (SnapExtend m) = r v >>= \e -> case e of
106   - Left s -> return (runReaderT m s, return (), return [])
107   - Right (s, a, b) -> return (runReaderT m s, a, b)
  115 +-- | Given the Initializer for your application's state, and a value in the
  116 +-- monad formed by 'SnapExtend' wrapped it, this returns a 'Snap' action, a
  117 +-- cleanup action and a reload action.
  118 +runInitializer :: Bool
  119 + -- ^ Verbosity; info is printed to 'stderr' when this is 'True'
  120 + -> Initializer s
  121 + -- ^ The Initializer value
  122 + -> SnapExtend s ()
  123 + -- ^ An action in your application's monad
  124 + -> IO (Snap (), IO (), IO [(ByteString, Maybe ByteString)])
  125 + -- ^ This is documented thoroughly in the README
  126 +runInitializer v (Initializer r) (SnapExtend m) = r v >>= \e -> case e of
  127 + Left s -> return (runReaderT m s, return (), return [])
  128 + Right (SCR s a b) -> return (runReaderT m s, a, b)
108 129
109 130
110 131 ------------------------------------------------------------------------------
111   --- | Serves the same purpose as 'runRunner', but can be used with Hint. This
112   --- is explained in the README.
113   -runRunnerHint :: Bool
114   - -- ^ Verbosity; info is printed to 'stderr' when this is 'True'
115   - -> Runner s
116   - -- ^ The Runner value
117   - -> SnapExtend s ()
118   - -- ^ An action in your application's monad.
119   - -> (IO [(ByteString, Maybe ByteString)] -> SnapExtend s ())
120   - -- ^ See README and 'defaultReloadHandler'
121   - -> IO (IO s, s -> IO (), s -> Snap ())
122   - -- ^ A tuple of values which can be passed to @loadSnapTH@.
123   -runRunnerHint v (Runner r) se@(SnapExtend m) f = r v >>= \e -> case e of
124   - Left s -> return (return s, const $ return (), runReaderT m)
125   - Right (s, a, b) -> let (SnapExtend m') = f b <|> se
126   - in return (return s, const a, runReaderT m')
  132 +-- | Serves the same purpose as 'runInitializer', but can be used with Hint.
  133 +-- This is explained in the README.
  134 +runInitializerHint :: Bool
  135 + -- ^ Verbosity; info is printed to 'stderr' when this is
  136 + -- 'True'
  137 + -> Initializer s
  138 + -- ^ The Initializer value
  139 + -> SnapExtend s ()
  140 + -- ^ An action in your application's monad.
  141 + -> (IO [(ByteString, Maybe ByteString)] -> SnapExtend s ())
  142 + -- ^ See README and 'defaultReloadHandler'
  143 + -> IO (IO s, s -> IO (), s -> Snap ())
  144 + -- ^ A tuple of values which can be passed to @loadSnapTH@.
  145 +runInitializerHint v (Initializer r) se@(SnapExtend m) f = r v >>= \e -> case e of
  146 + Left s -> return (return s, const $ return (), runReaderT m)
  147 + Right (SCR s a b) -> let (SnapExtend m') = f b <|> se
  148 + in return (return s, const a, runReaderT m')
127 149
128 150
129 151 ------------------------------------------------------------------------------
130   -instance Functor Runner where
131   - fmap f (Runner r) = Runner $ \v -> r v >>= \e -> return $ case e of
132   - Left s -> Left $ f s
133   - Right (s, a, b) -> Right (f s, a, b)
  152 +instance Functor Initializer where
  153 + fmap f (Initializer r) = Initializer $ \v -> r v >>= \e -> return $ case e of
  154 + Left s -> Left $ f s
  155 + Right (SCR s a b) -> Right $ SCR (f s) a b
134 156
135 157
136 158 ------------------------------------------------------------------------------
137   -instance Applicative Runner where
  159 +instance Applicative Initializer where
138 160 pure = return
139 161 (<*>) = ap
140 162
141 163
142 164 ------------------------------------------------------------------------------
143   -instance Monad Runner where
144   - return = Runner . const . return . Left
  165 +instance Monad Initializer where
  166 + return = Initializer . const . return . Left
145 167 a >>= f = join' $ fmap f a
146 168
147 169
148 170 ------------------------------------------------------------------------------
149   -instance MonadIO Runner where
150   - liftIO = Runner . const . fmap Left
  171 +instance MonadIO Initializer where
  172 + liftIO = Initializer . const . fmap Left
151 173
152 174
153 175 ------------------------------------------------------------------------------
154   --- | Join for the 'Runner' monad. This is used in the definition of bind for
155   --- the 'Runner' monad.
156   -join' :: Runner (Runner s) -> Runner s
157   -join' (Runner r) = Runner $ \v -> r v >>= \e -> case e of
158   - Left (Runner r') -> r' v
159   - Right (Runner r', a, b) -> r' v >>= \e' -> return $ Right $ case e' of
160   - Left s -> (s, a, b)
161   - Right (s, a', b') -> (s, a' >> a, liftM2 (++) b b')
  176 +-- | Join for the 'Initializer' monad. This is used in the definition of bind
  177 +-- for the 'Initializer' monad.
  178 +join' :: Initializer (Initializer s) -> Initializer s
  179 +join' (Initializer r) = Initializer $ \v -> r v >>= \e -> case e of
  180 + Left (Initializer r') -> r' v
  181 + Right (SCR (Initializer r') a b) -> r' v >>= \e' -> return $ Right $ case e' of
  182 + Left s -> SCR s a b
  183 + Right (SCR s a' b') -> SCR s (a' >> a) (liftM2 (++) b b')
162 184
163 185
164 186 ------------------------------------------------------------------------------
165   --- | This takes the last value of the tuple returned by 'runRunner', which is
166   --- a list representing the results of an attempt to reload the application's
167   --- Snap Extensions, and turns it into a Snap action which displays the these
168   --- results.
  187 +-- | This takes the last value of the tuple returned by 'runInitializer',
  188 +-- which is a list representing the results of an attempt to reload the
  189 +-- application's Snap Extensions, and turns it into a Snap action which
  190 +-- displays the these results.
169 191 defaultReloadHandler :: MonadSnap m
170 192 => IO [(ByteString, Maybe ByteString)]
171 193 -> m ()
12 src/Snap/Extension/ConnectionPool.hs
@@ -13,15 +13,23 @@ monad into a 'MonadConnectionPool'.
13 13
14 14 -}
15 15
16   -module Snap.Extension.ConnectionPool (MonadConnectionPool(..)) where
  16 +module Snap.Extension.ConnectionPool
  17 + ( MonadConnectionPool(..)
  18 + , IsConnectionPoolState(..)) where
17 19
  20 +import Control.Monad.Trans
18 21 import Database.HDBC
19 22 import Snap.Types
20 23
21 24 ------------------------------------------------------------------------------
22 25 -- | The 'MonadConnectionPool' type class. Minimal complete definition:
23 26 -- 'withConnection'.
24   -class MonadSnap m => MonadConnectionPool m where
  27 +class MonadIO m => MonadConnectionPool m where
25 28 -- | Given an action, wait for an available connection from the pool and
26 29 -- execute the action. Return the result.
27 30 withConnection :: (forall c. IConnection c => c -> IO a) -> m a
  31 +
  32 +
  33 +------------------------------------------------------------------------------
  34 +class IsConnectionPoolState a where
  35 + withConnectionFromPool :: MonadIO m => (forall c. IConnection c => c -> IO b) -> a -> m b
42 src/Snap/Extension/ConnectionPool/ConnectionPool.hs
@@ -8,12 +8,12 @@
8 8
9 9 As always, to use, add 'ConnectionPoolState' to your application's state,
10 10 along with an instance of 'HasConnectionPoolState' for your application's
11   -state, making sure to use a 'connectionPoolRunner' in your application's
12   -'Runner', and then you're ready to go.
  11 +state, making sure to use a 'connectionPoolInitializer' in your application's
  12 +'Initializer', and then you're ready to go.
13 13
14 14 The 'ConnectionPoolState' has a maximum size associated with it, but it won't
15 15 not get filled up until necessary. It will not create actual connections until
16   -requested, it will go round-robin through the connection pool to create them.
  16 +requested, it will go round-robin through the connection pool to create them.
17 17 This should suffice for both production (one pool for all requests until
18 18 server shutdown) and development (one pool per request) cases.
19 19
@@ -25,7 +25,7 @@ interfaces from any other Snap Extension.
25 25 module Snap.Extension.ConnectionPool.ConnectionPool
26 26 ( HasConnectionPoolState(..)
27 27 , ConnectionPoolState
28   - , connectionPoolRunner
  28 + , connectionPoolInitializer
29 29   ) where
30 30
31 31 import Control.Concurrent.Chan
@@ -66,23 +66,22 @@ data ConnectionPoolState = ConnectionPoolState
66 66 class HasConnectionPoolState s where
67 67 getConnectionPoolState :: s -> ConnectionPoolState
68 68 setConnectionPoolState :: ConnectionPoolState -> s -> s
69   -
70 69
71 70
72 71 ------------------------------------------------------------------------------
73   --- | The 'Runner' for 'ConnectionPoolState'. It takes two arguments, an 'IO'
74   --- action which creates an instance of 'IConnection', and the desired maximum
75   --- size of the pool.
76   -connectionPoolRunner :: IConnection a
77   - => IO a -> Int -> Runner ConnectionPoolState
78   -connectionPoolRunner mkConn size = do
  72 +-- | The 'Initializer' for 'ConnectionPoolState'. It takes two arguments, an
  73 +-- 'IO' action which creates an instance of 'IConnection', and the desired
  74 +-- maximum size of the pool.
  75 +connectionPoolInitializer :: IConnection a
  76 + => IO a -> Int -> Initializer ConnectionPoolState
  77 +connectionPoolInitializer mkConn size = do
79 78 chan <- liftIO newChan
80 79 liftIO $ replicateM_ size $ writeChan chan Nothing
81   - mkRunner $ ConnectionPoolState (mkConn >>= return . Connection) chan size
  80 + mkInitializer $ ConnectionPoolState (mkConn >>= return . Connection) chan size
82 81
83 82
84 83 ------------------------------------------------------------------------------
85   -instance RunnerState ConnectionPoolState where
  84 +instance InitializerState ConnectionPoolState where
86 85 extensionId = const "ConnectionPool/ConnectionPool"
87 86
88 87 mkCleanup (ConnectionPoolState _ chan size) = replicateM_ size $ do
@@ -95,15 +94,16 @@ instance RunnerState ConnectionPoolState where
95 94
96 95 ------------------------------------------------------------------------------
97 96 instance HasConnectionPoolState s => MonadConnectionPool (SnapExtend s) where
98   - withConnection f = do
99   - (ConnectionPoolState mkConn chan _) <- asks getConnectionPoolState
100   - conn@(Connection c) <- liftIO $ readChan chan >>= maybe mkConn return
101   -     liftIO $ f c `finally` (commit c >> writeChan chan (Just conn))
  97 + withConnection f = asks getConnectionPoolState >>= withConnectionFromPool f
102 98
103 99
104 100 ------------------------------------------------------------------------------
105 101 instance (MonadSnap m, HasConnectionPoolState s) => MonadConnectionPool (ReaderT s m) where
106   - withConnection f = do
107   - (ConnectionPoolState mkConn chan _) <- asks getConnectionPoolState
108   - conn@(Connection c) <- liftIO $ readChan chan >>= maybe mkConn return
109   -     liftIO $ f c `finally` (commit c >> writeChan chan (Just conn))
  102 + withConnection f = asks getConnectionPoolState >>= withConnectionFromPool f
  103 +
  104 +
  105 +------------------------------------------------------------------------------
  106 +instance IsConnectionPoolState ConnectionPoolState where
  107 + withConnectionFromPool f (ConnectionPoolState mkConn chan _) = liftIO $ do
  108 + conn@(Connection c) <- readChan chan >>= maybe mkConn return
  109 +     f c `finally` (commit c >> writeChan chan (Just conn))
16 src/Snap/Extension/Heist/Heist.hs
@@ -11,8 +11,8 @@ interface defined in 'Snap.Extension.Heist'.
11 11
12 12 As always, to use, add 'HeistState' to your application's state, along with an
13 13 instance of 'HasHeistState' for your application's state, making sure to
14   -use a 'heistRunner' in your application's 'Runner', and then you're ready to
15   -go.
  14 +use a 'heistInitializer' in your application's 'Initializer', and then you're
  15 +ready to go.
16 16
17 17 'Snap.Extension.Heist.Heist' is a little different to other Snap Extensions,
18 18 which is unfortunate as it is probably the most widely useful one. As
@@ -49,7 +49,7 @@ interfaces from any other Snap Extension.
49 49 module Snap.Extension.Heist.Heist
50 50 ( HeistState
51 51 , HasHeistState(..)
52   - , heistRunner
  52 + , heistInitializer
53 53 ) where
54 54
55 55 import Control.Applicative
@@ -111,20 +111,20 @@ class MonadSnap m => HasHeistState m s | s -> m where
111 111
112 112
113 113 ------------------------------------------------------------------------------
114   --- | The 'Runner' for 'HeistState'. It takes one argument, a path to a
  114 +-- | The 'Initializer' for 'HeistState'. It takes one argument, a path to a
115 115 -- template directory containing @.tpl@ files.
116   -heistRunner :: MonadSnap m => FilePath -> Runner (HeistState m)
117   -heistRunner path = do
  116 +heistInitializer :: MonadSnap m => FilePath -> Initializer (HeistState m)
  117 +heistInitializer path = do
118 118 heistState <- liftIO $ do
119 119 (origTs,sts) <- bindStaticTag emptyTemplateState
120 120 loadTemplates path origTs >>= either error (\ts -> do
121 121 tsMVar <- newMVar ts
122 122 return $ HeistState path origTs tsMVar sts id)
123   - mkRunner heistState
  123 + mkInitializer heistState
124 124
125 125
126 126 ------------------------------------------------------------------------------
127   -instance MonadSnap m => RunnerState (HeistState m) where
  127 +instance MonadSnap m => InitializerState (HeistState m) where
128 128 extensionId = const "Heist/Heist"
129 129 mkCleanup = const $ return ()
130 130 mkReload (HeistState path origTs tsMVar sts _) = do
12 src/Snap/Extension/Less/Less.hs
@@ -7,7 +7,7 @@ interface defined in 'Snap.Extension.Less'.
7 7
8 8 As always, to use, add 'LessState' to your application's state, along with an
9 9 instance of 'HasLessState' for your application's state, making sure to use a
10   -'lessRunner' in your application's 'Runner', and then you're ready to go.
  10 +'lessInitializer' in your application's 'Initializer', and then you're ready to go.
11 11
12 12 This implementation does not require that your application's monad implement
13 13 interfaces from any other Snap Extension.
@@ -17,7 +17,7 @@ interfaces from any other Snap Extension.
17 17 module Snap.Extension.Less.Less
18 18 ( HasLessState(..)
19 19 , LessState
20   - , lessRunner
  20 + , lessInitializer
21 21 ) where
22 22
23 23 import Control.Concurrent
@@ -61,17 +61,17 @@ class HasLessState s where
61 61
62 62
63 63 ------------------------------------------------------------------------------
64   -instance RunnerState LessState where
  64 +instance InitializerState LessState where
65 65 extensionId = const "Less/Less"
66 66 mkCleanup = const $ return ()
67 67 mkReload (LessState d m) = modifyMVar_ m $ const $ loadStylesheets d
68 68
69 69
70 70 ------------------------------------------------------------------------------
71   --- | The Runner for the Less extension. It takes a path to a stylesheet
  71 +-- | The Initializer for the Less extension. It takes a path to a stylesheet
72 72 -- directory containing @.less@ files.
73   -lessRunner :: FilePath -> Runner LessState
74   -lessRunner path = mkRunner =<< (liftIO $
  73 +lessInitializer :: FilePath -> Initializer LessState
  74 +lessInitializer path = mkInitializer =<< (liftIO $
75 75 loadStylesheets path >>= newMVar >>= return . LessState path)
76 76
77 77
17 src/Snap/Extension/Server.hs
@@ -5,7 +5,7 @@
5 5 {-|
6 6
7 7 This module provides replacements for the 'httpServe' and 'quickHttpServe'
8   -functions exported by 'Snap.Http.Server'. By taking a 'Runner' as an argument,
  8 +functions exported by 'Snap.Http.Server'. By taking a 'Initializer' as an argument,
9 9 these functions simplify the glue code that is needed to use Snap Extensions.
10 10 In particular, 'Snap.Extension.Server.Hint' provides function with identical
11 11 type signatures to the ones exported by this module, but which dynamically
@@ -107,17 +107,16 @@ completeConfig = mappend defaultConfig
107 107 -- the HTTP server, kill the controlling thread.
108 108 httpServe :: ConfigExtend s
109 109 -- ^ Any configuration options which override the defaults
110   - -> Runner s
111   - -- ^ The 'Runner' function for the application's monad
  110 + -> Initializer s
  111 + -- ^ The 'Initializer' function for the application's monad
112 112 -> SnapExtend s ()
113 113 -- ^ The application to be served
114 114 -> IO ()
115   -httpServe config runner handler = do
  115 +httpServe config init handler = do
116 116 (state, mkCleanup, mkSnap) <-
117   - runRunnerHint verbose runner (catch500 handler) reloader
  117 + runInitializerHint verbose init (catch500 handler) reloader
118 118 #ifdef HINT
119   - (cleanup, snap) <-
120   - $(loadSnapTH 'state 'mkCleanup 'mkSnap)
  119 + (cleanup, snap) <- $(loadSnapTH 'state 'mkCleanup 'mkSnap)
121 120 #else
122 121 (cleanup, snap) <- fmap (mkCleanup &&& mkSnap) state
123 122 #endif
@@ -145,8 +144,8 @@ httpServe config runner handler = do
145 144 -- | Starts serving HTTP using the given handler. The configuration is read
146 145 -- from the options given on the command-line, as returned by
147 146 -- 'commandLineConfig'.
148   -quickHttpServe :: Runner s
149   - -- ^ The 'Runner' function for the application's monad
  147 +quickHttpServe :: Initializer s
  148 + -- ^ The 'Initializer' function for the application's monad
150 149 -> SnapExtend s ()
151 150 -- ^ The application to be served
152 151 -> IO ()
12 src/Snap/Extension/Timer/Timer.hs
@@ -7,7 +7,7 @@ interface defined in 'Snap.Extension.Timer'.
7 7
8 8 As always, to use, add 'TimerState' to your application's state, along with an
9 9 instance of 'HasTimerState' for your application's state, making sure to use a
10   -'timerRunner' in your application's 'Runner', and then you're ready to go.
  10 +'timerInitializer' in your application's 'Initializer', and then you're ready to go.
11 11
12 12 This implementation does not require that your application's monad implement
13 13 interfaces from any other Snap Extension.
@@ -17,7 +17,7 @@ interfaces from any other Snap Extension.
17 17 module Snap.Extension.Timer.Timer
18 18 ( TimerState
19 19 , HasTimerState(..)
20   - , timerRunner
  20 + , timerInitializer
21 21 ) where
22 22
23 23 import Control.Monad.Reader
@@ -45,13 +45,13 @@ class HasTimerState s where
45 45
46 46
47 47 ------------------------------------------------------------------------------
48   --- | The runner for 'TimerState'. No arguments are required.
49   -timerRunner :: Runner TimerState
50   -timerRunner = liftIO getCurrentTime >>= mkRunner . TimerState
  48 +-- | The Initializer for 'TimerState'. No arguments are required.
  49 +timerInitializer :: Initializer TimerState
  50 +timerInitializer = liftIO getCurrentTime >>= mkInitializer . TimerState
51 51
52 52
53 53 ------------------------------------------------------------------------------
54   -instance RunnerState TimerState where
  54 +instance InitializerState TimerState where
55 55 extensionId = const "Timer/Timer"
56 56 mkCleanup = const $ return ()
57 57 mkReload = const $ return ()

0 comments on commit b036f7f

Please sign in to comment.
Something went wrong with that request. Please try again.