@@ -56,14 +56,15 @@ checkMainType typeEnv decls =
56 A.A (region,_) (Decl.Def (Valid.Definition (A.A _ (P.Var "main")) _ _)) : _ ->
56 A.A (region,_) (Decl.Def (Valid.Definition (A.A _ (P.Var "main")) _ _)) : _ ->
57 case Map.lookup "main" typeEnv of
57 case Map.lookup "main" typeEnv of
58 Nothing ->
58 Nothing ->
62+ case Type.deepDealias tipe of
63+ Type.App (Type.Type name) [_] | name == virtualDomNode ->
59− return ()
64+ return ()
61− Just typeOfMain ->
66+ _ ->
62− let tipe = Type.deepDealias typeOfMain
64− if tipe `elem` validMainTypes
66− else Result.throw region (Error.BadMain typeOfMain)
67+ Result.throw region (Error.BadMain tipe)
68 _ : remainingDecls ->
69 _ : remainingDecls ->
69 checkMainType typeEnv remainingDecls
70 checkMainType typeEnv remainingDecls
@@ -72,37 +73,9 @@ checkMainType typeEnv decls =
75−validMainTypes :: [Type.Canonical]
76+virtualDomNode :: Var.Canonical
76−validMainTypes =
77+virtualDomNode =
84−html :: Type.Canonical
86− Type.Type (Var.fromModule virtualDom "Node")
78+ Var.fromModule
89−virtualDom :: ModuleName.Canonical
91− ModuleName.Canonical (Pkg.Name "evancz" "virtual-dom") ["VirtualDom"]
79+ (ModuleName.Canonical (Pkg.Name "evancz" "virtual-dom") ["VirtualDom"])
94−element :: Type.Canonical
96− core ["Graphics","Element"] "Element"
99−signal :: Type.Canonical -> Type.Canonical
101− Type.App (core ["Signal"] "Signal") [ tipe ]
104−core :: [String] -> String -> Type.Canonical
106− Type.Type (Var.inCore home name)