on master help sign in
Add Platform.Program as acceptable `main` type
commite1226d89f5500683c38246df171a12b3d6d66d96 authorEvan Czaplicki <info@elm-lang.org> dateMon 22 Feb 2016, 01:44 (11 years ago) parentbbb6583
1 file changed+9
src/Nitpick/TopLevelTypes.hs+9
src/Nitpick/TopLevelTypes.hs+9
@@ -42,6 +42,7 @@ warnMissingAnnotation typeEnv (A.A (region,_) decl) =
4242 case Map.lookup name typeEnv of
4343 Nothing ->
4444 return ()
45+
4546 Just tipe ->
4647 Result.warn region (Warning.MissingTypeAnnotation name tipe)
4748 _ ->
@@ -68,6 +69,9 @@ checkMainType typeEnv decls =
6869 Type.App (Type.Type name) [_] | name == virtualDomNode ->
6970 return ()
7071
72+ Type.App (Type.Type name) [_] | name == program ->
73+ return ()
74+
7175 _ ->
7276 Result.throw region (Error.BadMain tipe)
7377
@@ -84,3 +88,8 @@ virtualDomNode =
8488 (ModuleName.Canonical (Pkg.Name "evancz" "virtual-dom") ["VirtualDom"])
8589 "Node"
8690
91+
92+program :: Var.Canonical
93+program =
94+ Var.fromModule (ModuleName.inCore ["Platform"]) "Program"
95+