@@ -14,8 +14,7 @@ module Obelisk.Backend
1414 , runBackend
1515 , runBackendWith
1616 -- * Configuration of backend
17− , GhcjsWidgets
18− , GhcjsWidgetsImpl(..)
17+ , GhcjsWidgets(..)
1918 , defaultGhcjsWidgets
2019 -- * all.js script loading functions
2120 , deferredGhcjsScript
@@ -70,10 +69,8 @@ data GhcjsApp route = GhcjsApp
7069 , _ghcjsApp_value :: !(Frontend route)
7170 }
7271
73−type GhcjsWidgets r = GhcjsWidgetsImpl (Text -> FrontendWidgetT r ())
74−
7572-- | Widgets used to load all.js on the frontend
76−data GhcjsWidgetsImpl a = GhcjsWidgets
73+data GhcjsWidgets a = GhcjsWidgets
7774 { _ghcjsWidgets_preload :: a
7875 -- ^ A preload widget, placed in the document head
7976 , _ghcjsWidgets_script :: a
@@ -82,7 +79,7 @@ data GhcjsWidgetsImpl a = GhcjsWidgets
8279
8380-- | Given the URL of all.js, return the widgets which are responsible for
8481-- loading the script. Defaults to 'preloadGhcjs' and 'deferredGhcjsScript'.
85−defaultGhcjsWidgets :: GhcjsWidgets r
82+defaultGhcjsWidgets :: GhcjsWidgets (Text -> FrontendWidgetT r ())
8683defaultGhcjsWidgets = GhcjsWidgets
8784 { _ghcjsWidgets_preload = preloadGhcjs
8885 , _ghcjsWidgets_script = deferredGhcjsScript
@@ -93,7 +90,7 @@ defaultGhcjsWidgets = GhcjsWidgets
9390serveDefaultObeliskApp
9491 :: (MonadSnap m, HasCookies m, MonadFail m)
9592 => (R appRoute -> Text)
96− -> GhcjsWidgetsImpl (FrontendWidgetT (R appRoute) ())
93+ -> GhcjsWidgets (FrontendWidgetT (R appRoute) ())
9794 -> ([Text] -> m ())
9895 -> Frontend (R appRoute)
9996 -> Map Text ByteString
@@ -154,7 +151,7 @@ renderAllJsPath validFullEncoder =
154151serveObeliskApp
155152 :: (MonadSnap m, HasCookies m, MonadFail m)
156153 => (R appRoute -> Text)
157− -> GhcjsWidgetsImpl (FrontendWidgetT (R appRoute) ())
154+ -> GhcjsWidgets (FrontendWidgetT (R appRoute) ())
158155 -> ([Text] -> m ())
159156 -> GhcjsApp (R appRoute)
160157 -> Map Text ByteString
@@ -191,7 +188,7 @@ staticRenderContentType = "text/html; charset=utf-8"
191188serveGhcjsApp
192189 :: (MonadSnap m, HasCookies m, MonadFail m)
193190 => (R appRouteComponent -> Text)
194− -> GhcjsWidgetsImpl (FrontendWidgetT (R appRouteComponent) ())
191+ -> GhcjsWidgets (FrontendWidgetT (R appRouteComponent) ())
195192 -> GhcjsApp (R appRouteComponent)
196193 -> Map Text ByteString
197194 -> R (GhcjsAppRoute appRouteComponent)
@@ -207,7 +204,7 @@ runBackend :: Backend backendRoute frontendRoute -> Frontend (R frontendRoute) -
207204runBackend = runBackendWith defaultGhcjsWidgets
208205
209206runBackendWith
210− :: GhcjsWidgets (R frontendRoute)
207+ :: GhcjsWidgets (Text -> FrontendWidgetT (R frontendRoute) ())
211208 -- ^ Given the URL of all.js, return the widgets which are responsible for
212209 -- loading the script.
213210 -> Backend backendRoute frontendRoute
@@ -232,7 +229,7 @@ runBackendWith ghcjsWidgets backend frontend = case checkEncoder $ _backend_rout
232229renderGhcjsFrontend
233230 :: (MonadSnap m, HasCookies m)
234231 => (route -> Text)
235− -> GhcjsWidgetsImpl (FrontendWidgetT route ())
232+ -> GhcjsWidgets (FrontendWidgetT route ())
236233 -> route
237234 -> Map Text ByteString
238235 -> Frontend route