Document IsString instance for WidgetT.
This commit is contained in:
parent
4e354c9e07
commit
66ed314866
@ -250,6 +250,13 @@ instance (a ~ (), Monad m) => Monoid (WidgetT site m a) where
|
||||
mempty = return ()
|
||||
mappend x y = x >> y
|
||||
instance (a ~ (), Monad m) => Semigroup (WidgetT site m a)
|
||||
|
||||
-- | Any type with an 'IsString' instance can be trivially
|
||||
-- promoted to a widget.
|
||||
--
|
||||
-- For example, in a yesod-scaffold site you could use:
|
||||
--
|
||||
-- @getHomeR = do defaultLayout "Widget text"@
|
||||
instance (Monad m, a ~ ()) => IsString (WidgetT site m a) where
|
||||
fromString = toWidget . toHtml . T.pack
|
||||
where toWidget x = WidgetT $ const $ return $ ((), GWData (Body (const x))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user