Verified Commit 95b673ec authored by Camil Staps's avatar Camil Staps 🚀

Highlighting for #175

parent f074af39
......@@ -184,19 +184,19 @@ bs_funcdep =
{ syntax_title = "functional dependency"
, syntax_patterns = ["~"]
, syntax_code =
[ "class c a ~b"
[ "class ... ~... ..."
]
, syntax_description =
"Lets you point the type checker to the type that determines the other types.\n\n" +
"Most often this is the return type (undocumented and experimental)"
"Most often this is the return type (undocumented and experimental)."
, syntax_doc_locations = []
, syntax_examples = map (EX "Function")
[ "class plus a b c :: a b -> c"
, "instance plus Int Int Int where plus x y = x + y"
, "Start = plus 1 (plus 1 1) // Results in: internal overloading of \"plus\" could not be solved because the compiler doesn't know the type of the intermediate result."
, "class plus a b ~c :: a b -> c"
, "instance plus Int Int Int where plus x y = x + y"
, "Start = plus 1 (plus 1 1) // Works! because we told the compiler that c determines the other types."
, syntax_examples = map (EX "Function") // TODO highlighting
[ "class plus a b c :: a b -> c\n" +
"instance plus Int Int Int where plus x y = x + y\n" +
"Start = plus 1 (plus 1 1) // Results in: internal overloading of \"plus\" could not be solved because the compiler doesn't know the type of the intermediate result."
, "class plus a b ~c :: a b -> c\n" +
"instance plus Int Int Int where plus x y = x + y\n" +
"Start = plus 1 (plus 1 1) // Works! because we told the compiler that c determines the other types."
]
}
......
......@@ -484,7 +484,7 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
if ('cls' in extra)
meta.push('Class: <code>' +
highlightClassDef(extra['cls']['cls_name'] +
highlightFunction(extra['cls']['cls_name'] +
' ' + extra['cls']['cls_vars'].join(' '),
highlightCallback, 'className') + '</code>');
......@@ -550,7 +550,7 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
'Instances',
makeInstanceTable(
extra['type_instances'],
highlightClassDef, 'className'),
highlightFunction, 'className'),
pluralise(extra['type_instances'].length, 'instance')]);
}
......@@ -591,7 +591,7 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
makeInstanceTable(extra['class_instances'], highlightType),
pluralise(extra['class_instances'].length, 'instance')]);
var html = highlightClassDef(
var html = highlightFunction(
'class ' + extra['class_heading'] +
(extra['class_funs'].length > 0 ? ' where' : ''),
highlightCallback) + '\n';
......
Subproject commit c890336f51473905b7a07205906fbaaac94b5ab7
Subproject commit 6aee8f7addd23b4d33f969155791eb46299ee645
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment