1{-# OPTIONS_GHC -Wall #-}
3{-| This module contains checks to be run *after* type inference has completed
4successfully. At that point we still need to ensure that `main` has an
7module Type.ExtraChecks (mainType) where
9import Prelude hiding (maybe)
10import Control.Monad.Except (ExceptT, throwError)
11import qualified Data.Map as Map
13import qualified AST.Type as ST
14import qualified AST.Variable as Var
21 => Map.Map String ST.Canonical
22 -> ExceptT ST.Canonical m ()
24 case Map.lookup "main" env of
29 let tipe = ST.deepDealias typeOfMain
31 if tipe `elem` validMainTypes
33 else throwError typeOfMain
36validMainTypes :: [ST.Canonical]
44 fromModule :: [String] -> String -> ST.Canonical
45 fromModule home name =
46 ST.Type (Var.fromModule home name)
49 fromModule ["VirtualDom"] "Node"
52 ST.App (fromModule ["Signal"] "Signal") [ tipe ]
56 ST.Type (Var.builtin name)
59 ST.App (fromModule ["Maybe"] "Maybe") [ tipe ]
62 [ ("element", fromModule ["Graphics","Element"] "ElementPrim")
65 [ ("click" , builtin "_Tuple0")
66 , ("color" , maybe (fromModule ["Color"] "Color"))
67 , ("height" , builtin "Int")
68 , ("hover" , builtin "_Tuple0")
69 , ("href" , builtin "String")
70 , ("id" , builtin "Int")
71 , ("opacity", builtin "Float")
72 , ("tag" , builtin "String")
73 , ("width" , builtin "Int")
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list