on master help sign in
Get rid of dead function and give instantiateTypeWithContext a shorter name
commit0681fbe583aef34c5fd215fc366a733429dc1dc7 authorEvan Czaplicki <info@elm-lang.org> dateFri 26 Jul 2013, 12:22 (13 years ago) parent32a331b
3 files changed+5−12
compiler/Type/Constrain/Expression.hs+1−1 compiler/Type/Environment.hs+3−10 compiler/Type/Inference.hs+1−1
compiler/Type/Constrain/Expression.hs+1−1
@@ -185,7 +185,7 @@ constrainDef env info (pattern, expr, maybeTipe) =
185185 do flexiVars <- mapM (\_ -> var Flexible) qs
186186 let inserts = zipWith (\arg typ -> Map.insert arg (VarN typ)) qs flexiVars
187187 env' = env { Env.value = List.foldl' (\x f -> f x) (Env.value env) inserts }
188− (vars, typ) <- Env.instantiateTypeWithContext env tipe Map.empty
188+ (vars, typ) <- Env.instantiateType env tipe Map.empty
189189 let scheme = Scheme { rigidQuantifiers = [],
190190 flexibleQuantifiers = flexiVars ++ vars,
191191 constraint = CTrue,
compiler/Type/Environment.hs+3−10
@@ -102,16 +102,9 @@ get env subDict key = Map.findWithDefault err key (subDict env)
102102freshDataScheme :: Environment -> String -> IO (Int, [Variable], [Type], Type)
103103freshDataScheme env name = get env constructor name
104104
105−
106−instantiateType :: Environment -> Src.Type -> IO Type
107−instantiateType env sourceType =
108− snd <$> instantiateTypeWithContext env sourceType Map.empty
109−
110−instantiateTypeWithContext :: Environment
111− -> Src.Type
112− -> Map.Map String Variable
113− -> IO ([Variable], Type)
114−instantiateTypeWithContext env sourceType dict =
105+instantiateType ::
106+ Environment -> Src.Type -> Map.Map String Variable -> IO ([Variable], Type)
107+instantiateType env sourceType dict =
115108 do (tipe, dict') <- State.runStateT (instantiator env sourceType) dict
116109 return (Map.elems dict', tipe)
117110
compiler/Type/Inference.hs+1−1
@@ -47,7 +47,7 @@ infer interfaces' modul = unsafePerformIO $ do
4747
4848 importedVars <-
4949 forM (concatMap Map.toList $ Map.elems locals) $ \(name,tipe) ->
50− (,) name `fmap` Env.instantiateTypeWithContext env tipe Map.empty
50+ (,) name `fmap` Env.instantiateType env tipe Map.empty
5151
5252 let allTypes = ctors ++ importedVars
5353 vars = concatMap (fst . snd) allTypes