Compiles without warnings
This commit is contained in:
parent
921dbf9b6c
commit
b1042c2b0f
@ -1,4 +1,9 @@
|
|||||||
|
I in general recommend type signatures for everything. However, I wanted
|
||||||
|
to show in this example how it is possible to get away without the
|
||||||
|
signatures.
|
||||||
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
|
||||||
import Yesod
|
import Yesod
|
||||||
@ -18,11 +23,15 @@ instance Yesod Fact where
|
|||||||
index = return $ StaticFile TypeHtml "examples/fact.html"
|
index = return $ StaticFile TypeHtml "examples/fact.html"
|
||||||
fact i = return $ toHtmlObject
|
fact i = return $ toHtmlObject
|
||||||
[ ("input", show i)
|
[ ("input", show i)
|
||||||
, ("result", show $ product [1..fromIntegral i])
|
, ("result", show $ product [1..fromIntegral i :: Integer])
|
||||||
]
|
]
|
||||||
factRedirect = do
|
factRedirect = do
|
||||||
i <- getParam "num"
|
i <- getParam "num"
|
||||||
redirect $ "../" ++ i ++ "/"
|
redirect $ "../" ++ i ++ "/"
|
||||||
|
\end{code}
|
||||||
|
In particular, the following line would be unnecesary if we had a type
|
||||||
|
signature here.
|
||||||
|
\begin{code}
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user