From b1042c2b0ff9df36f9d875fa2bc4aede5de41356 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 21 Dec 2009 19:37:05 +0200 Subject: [PATCH] Compiles without warnings --- examples/fact.lhs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/fact.lhs b/examples/fact.lhs index 4ede5469..0c1ec939 100644 --- a/examples/fact.lhs +++ b/examples/fact.lhs @@ -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} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE QuasiQuotes #-} import Yesod @@ -18,11 +23,15 @@ instance Yesod Fact where index = return $ StaticFile TypeHtml "examples/fact.html" fact i = return $ toHtmlObject [ ("input", show i) - , ("result", show $ product [1..fromIntegral i]) + , ("result", show $ product [1..fromIntegral i :: Integer]) ] factRedirect = do i <- getParam "num" redirect $ "../" ++ i ++ "/" +\end{code} +In particular, the following line would be unnecesary if we had a type +signature here. +\begin{code} return () main :: IO ()