on master help sign in
Add Platform.Program as acceptable `main` type
e1226d8Evan Czaplicki
src/Nitpick/TopLevelTypes.hs+9
@@ -42,6 +42,7 @@ warnMissingAnnotation typeEnv (A.A (region,_) decl) =
42 case Map.lookup name typeEnv of
42 case Map.lookup name typeEnv of
43 Nothing ->
43 Nothing ->
44 return ()
44 return ()
45+
45 Just tipe ->
46 Just tipe ->
46 Result.warn region (Warning.MissingTypeAnnotation name tipe)
47 Result.warn region (Warning.MissingTypeAnnotation name tipe)
47 _ ->
48 _ ->
@@ -68,6 +69,9 @@ checkMainType typeEnv decls =
68 Type.App (Type.Type name) [_] | name == virtualDomNode ->
69 Type.App (Type.Type name) [_] | name == virtualDomNode ->
69 return ()
70 return ()
70
71
72+ Type.App (Type.Type name) [_] | name == program ->
73+ return ()
74+
71 _ ->
75 _ ->
72 Result.throw region (Error.BadMain tipe)
76 Result.throw region (Error.BadMain tipe)
73
77
@@ -84,3 +88,8 @@ virtualDomNode =
84 (ModuleName.Canonical (Pkg.Name "evancz" "virtual-dom") ["VirtualDom"])
88 (ModuleName.Canonical (Pkg.Name "evancz" "virtual-dom") ["VirtualDom"])
85 "Node"
89 "Node"
86
90
91+
92+program :: Var.Canonical
93+program =
94+ Var.fromModule (ModuleName.inCore ["Platform"]) "Program"
95+