@@ -21,8 +21,6 @@ import qualified AST.Canonical as Can
21import qualified AST.Optimized as Opt
21import qualified AST.Optimized as Opt
22import qualified AST.Module.Name as ModuleName
22import qualified AST.Module.Name as ModuleName
23import qualified Data.Index as Index
23import qualified Data.Index as Index
24−import qualified Elm.Compiler.Type as Type
25−import qualified Elm.Compiler.Type.Extract as Extract
26import qualified Elm.Interface as I
24import qualified Elm.Interface as I
27import qualified Elm.Name as N
25import qualified Elm.Name as N
28import qualified Generate.JavaScript.Builder as JS
26import qualified Generate.JavaScript.Builder as JS
@@ -30,6 +28,8 @@ import qualified Generate.JavaScript.Expression as Expr
30import qualified Generate.JavaScript.Name as Name
28import qualified Generate.JavaScript.Name as Name
31import qualified Generate.JavaScript.Mode as Mode
29import qualified Generate.JavaScript.Mode as Mode
32import qualified Reporting.Doc as D
30import qualified Reporting.Doc as D
31+import qualified Reporting.Render.Type as RT
32+import qualified Reporting.Render.Type.Localizer as L
@@ -68,26 +68,28 @@ addMain mode graph home _ state =
68-- GENERATE FOR REPL
68-- GENERATE FOR REPL
71−generateForRepl :: Bool -> Opt.Graph -> I.Interface -> ModuleName.Canonical -> N.Name -> B.Builder
71+generateForRepl :: Bool -> L.Localizer -> Opt.Graph -> I.Interface -> ModuleName.Canonical -> N.Name -> B.Builder
72−generateForRepl ansi (Opt.Graph _ graph _) iface home name =
72+generateForRepl ansi localizer (Opt.Graph _ graph _) iface home name =
74 mode = Mode.dev Mode.Client
74 mode = Mode.dev Mode.Client
75 debugState = addGlobal mode graph emptyState (Opt.Global ModuleName.debug "toString")
75 debugState = addGlobal mode graph emptyState (Opt.Global ModuleName.debug "toString")
76 evalState = addGlobal mode graph debugState (Opt.Global home name)
76 evalState = addGlobal mode graph debugState (Opt.Global home name)
78+ stateToBuilder evalState
78− stateToBuilder evalState <> print ansi home name (I._types iface ! name)
80+ print ansi localizer home name (I._types iface ! name)
81−print :: Bool -> ModuleName.Canonical -> N.Name -> Can.Annotation -> B.Builder
83+print :: Bool -> L.Localizer -> ModuleName.Canonical -> N.Name -> Can.Annotation -> B.Builder
82−print ansi home name annotation =
84+print ansi localizer home name (Can.Forall _ tipe) =
84 value = Name.toBuilder (Name.fromGlobal home name)
86 value = Name.toBuilder (Name.fromGlobal home name)
85 toString = Name.toBuilder (Name.fromKernel N.debug "toAnsiString")
87 toString = Name.toBuilder (Name.fromKernel N.debug "toAnsiString")
86− tipe = Type.toDoc Type.None (Extract.fromAnnotation annotation)
88+ tipeDoc = RT.canToDoc localizer RT.None tipe
87 bool = if ansi then "true" else "false"
89 bool = if ansi then "true" else "false"
89 "var _value = " <> toString <> "(" <> bool <> ", " <> value <> ");\n\
91 "var _value = " <> toString <> "(" <> bool <> ", " <> value <> ");\n\
90− \var _type = " <> B.stringUtf8 (show (D.toString tipe)) <> ";\n\
92+ \var _type = " <> B.stringUtf8 (show (D.toString tipeDoc)) <> ";\n\
91 \function _print(t) { console.log(_value + (" <> bool <> " ? '\x1b[90m' + t + '\x1b[0m' : t)); }\n\
93 \function _print(t) { console.log(_value + (" <> bool <> " ? '\x1b[90m' + t + '\x1b[0m' : t)); }\n\
92 \if (_value.length + 3 + _type.length >= 80 || _type.indexOf('\\n') >= 0) {\n\
94 \if (_value.length + 3 + _type.length >= 80 || _type.indexOf('\\n') >= 0) {\n\
93 \ _print('\\n : ' + _type.split('\\n').join('\\n '));\n\
95 \ _print('\\n : ' + _type.split('\\n').join('\\n '));\n\