on master help sign in
Add type annotations and make some -W recommendations
commiteed8fa106145cab52f7fa9eb1e02f1fda251a40c authorEvan Czaplicki <info@elm-lang.org> dateSat 4 Jan 2014, 16:16 (13 years ago) parentc03049a
1 file changed+11−8
compiler/Type/Type.hs+11−8
compiler/Type/Type.hs+11−8
@@ -62,7 +62,7 @@ monoscheme headers = Scheme [] [] (noneNoDocs CTrue) headers
6262infixl 8 /\
6363
6464(/\) :: Constraint a b -> Constraint a b -> Constraint a b
65−a@(L s1 c1) /\ b@(L s2 c2) =
65+a@(L _ c1) /\ b@(L _ c2) =
6666 case (c1, c2) of
6767 (CTrue, _) -> b
6868 (_, CTrue) -> a
@@ -95,6 +95,7 @@ data Flex = Rigid | Flexible | Constant | Is SuperType
9595data SuperType = Number | Comparable | Appendable
9696 deriving (Show, Eq)
9797
98+namedVar :: Flex -> String -> IO Variable
9899namedVar flex name = UF.fresh $ Descriptor {
99100 structure = Nothing,
100101 rank = noRank,
@@ -104,6 +105,7 @@ namedVar flex name = UF.fresh $ Descriptor {
104105 mark = noMark
105106 }
106107
108+var :: Flex -> IO Variable
107109var flex = UF.fresh $ Descriptor {
108110 structure = Nothing,
109111 rank = noRank,
@@ -113,6 +115,7 @@ var flex = UF.fresh $ Descriptor {
113115 mark = noMark
114116 }
115117
118+structuredVar :: Term1 Variable -> IO Variable
116119structuredVar structure = UF.fresh $ Descriptor {
117120 structure = Just structure,
118121 rank = noRank,
@@ -368,8 +371,8 @@ toSrcType variable = do
368371 Src.Record fs'' <$> toSrcType ext
369372 Nothing ->
370373 case name desc of
371− Just x@(c:cs) | Char.isLower c -> return (Src.Var x)
372− | otherwise -> return (Src.Data x [])
374+ Just x@(c:_) | Char.isLower c -> return (Src.Var x)
375+ | otherwise -> return (Src.Data x [])
373376 _ -> error $ concat
374377 [ "Problem converting the following type "
375378 , "from a type-checker type to a source-syntax type:"
@@ -383,12 +386,12 @@ collectApps variable = go [] variable
383386 go vars variable = do
384387 desc <- UF.descriptor variable
385388 case (structure desc, vars) of
386− (Nothing, [v] ) -> case name desc of
389+ (Nothing, [v]) -> case name desc of
387390 Just "_List" -> return (List v)
388391 _ -> return Other
389− (Nothing, vs ) -> case name desc of
392+ (Nothing, vs) -> case name desc of
390393 Just ctor | isTuple ctor -> return (Tuple vs)
391394 _ -> return Other
392− (Just term, vs) -> case term of
393− App1 a b -> go (vars ++ [b]) a
394− _ -> return Other
395+ (Just term, _) -> case term of
396+ App1 a b -> go (vars ++ [b]) a
397+ _ -> return Other