diff options
| author | Andrew <saintruler@gmail.com> | 2020-11-27 18:06:40 +0400 |
|---|---|---|
| committer | Andrew <saintruler@gmail.com> | 2020-11-27 18:06:40 +0400 |
| commit | 463665e8a91e8b0611c3e8413842182c67d3ea3d (patch) | |
| tree | 3779b3eb792e1e0e8a636be3c182f13206fefc8f /Web/Views.hs | |
| parent | 1cc6cfef971ccb3c1d70f2a5570e445556e4f6fb (diff) | |
Changed String to Text everywhere
Diffstat (limited to 'Web/Views.hs')
| -rw-r--r-- | Web/Views.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Web/Views.hs b/Web/Views.hs index b6ae013..6619d09 100644 --- a/Web/Views.hs +++ b/Web/Views.hs @@ -1,20 +1,25 @@ module Web.Views where import System.IO +import qualified Data.Text as T +import Data.Text (Text) import Web.Request import Web.Response indexGet (Request query url method) = - return $ HtmlResponse 200 "<strong>index</strong>" + return $ HtmlResponse 200 (T.pack "<strong>index</strong>") helloGet req = - return $ HtmlResponse 200 "<i>hello</i>" + return $ HtmlResponse 200 (T.pack "<i>hello</i>") +renderTemplate :: String -> IO Response renderTemplate name = do template <- readTemplate name return $ HtmlResponse 200 template +readTemplate :: String -> IO Text readTemplate name = do handle <- openFile ("templates/" ++ name) ReadMode - hGetContents handle
\ No newline at end of file + contents <- hGetContents handle + return $ T.pack contents |