on master help sign in
Allow Html types through main
f523629Evan Czaplicki
src/Type/ExtraChecks.hs+8−2
@@ -43,17 +43,23 @@ mainType environment =
43 Nothing -> return env
43 Nothing -> return env
44 Just typeOfMain
44 Just typeOfMain
45 | tipe `elem` acceptable -> return env
45 | tipe `elem` acceptable -> return env
46− | otherwise -> throwError err
46+ | otherwise -> throwError [ err ]
47 where
47 where
48 acceptable =
48 acceptable =
49 [ "Graphics.Element.Element"
49 [ "Graphics.Element.Element"
50 , "Signal.Signal Graphics.Element.Element"
50 , "Signal.Signal Graphics.Element.Element"
51+ , "Html.Html"
52+ , "Signal.Signal Html.Html"
51 ]
53 ]
52
54
53 tipe = PP.renderPretty typeOfMain
55 tipe = PP.renderPretty typeOfMain
54
56
55 err =
57 err =
58+ P.vcat
56− [ P.text "Type Error: 'main' must have type Element or (Signal Element)."
59+ [ P.text "Type Error: 'main' must have one of the following types:"
60+ , P.text " "
61+ , P.text " Element, Html, Signal Element, Signal Html"
62+ , P.text " "
57 , P.text "Instead 'main' has type:\n"
63 , P.text "Instead 'main' has type:\n"
58 , P.nest 4 (PP.pretty typeOfMain)
64 , P.nest 4 (PP.pretty typeOfMain)
59 , P.text " "
65 , P.text " "