Repository: gleam-lang/gleam (rust)

Issue:
HTML documentation sidebar: merge "functions" and "constants" into one section named "values"
The distinction isn't helpful, so lets merge them.

Pull request:
fix merged functions and constants as values in html docs generator
This closes #4214

Do we want the functions/constants removed from the main content area? I've kept them for now.


<details>
<summary>Here's a preview:</summary>

![brave_bBSFmXf0ig](https://github.com/user-attachments/assets/b8713240-295e-46c1-9933-6883532928ed)

</details>

_Thanks @giacomocavalieri for the moral support in discord as usual._

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2125b0d7a..27acb2256 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -162,9 +162,13 @@
 - Improve error messages when encrypting and decrypting local Hex API key.
   ([Samuel Cristobal](https://github.com/scristobal))
 
-- Deprecate `HEXPM_USER` and `HEXPM_PASS` in favour of `HEXPM_API_KEY`.
+- Deprecated `HEXPM_USER` and `HEXPM_PASS` in favour of `HEXPM_API_KEY`.
   ([Samuel Cristobal](https://github.com/scristobal))
 
+- The "functions" and "constants" sections of generated HTML documentation have
+  been merged into one "values" section.
+  ([Sam Zanca ](https://github.com/metruzanca))
+
 ### Language server
 
 - The language server now allows renaming of functions, constants,
diff --git a/README.md b/README.md
index 03b6ca912..9dc32185a 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,6 @@ Thank you to our sponsors! Gleam would not be possible without you.
 <!-- Below this line this file is autogenerated -->
 <p align="center">
   <a href="https://github.com/agundy">Aaron Gunderson</a> -
-  <a href="https://github.com/zeroows">Abdulrhman Alkhodiry</a> -
   <a href="https://github.com/abeljim">Abel Jimenez</a> -
   <a href="https://github.com/ad-ops">ad-ops</a> -
   <a href="https://github.com/AdamBrodzinski">Adam Brodzinski</a> -
@@ -61,6 +60,7 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/bgwdotdev">bgw</a> -
   <a href="https://github.com/bjartelund">Bjarte Aarmo Lund</a> -
   <a href="https://github.com/00bpa">Bjoern Paschen</a> -
+  <a href="https://github.com/borislav-rangelov">Borislav Rangelov</a> -
   <a href="https://github.com/bmehder">Brad Mehder</a> -
   <a href="https://github.com/brendisurfs">Brendan P. </a> -
   <a href="https://github.com/brettkolodny">brettkolodny</a> -
@@ -94,6 +94,7 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/colelawrence">Cole Lawrence</a> -
   <a href="https://github.com/insanitybit">Colin</a> -
   <a href="https://github.com/Comamoca">Comamoca</a> -
+  <a href="https://github.com/comet-ml">Comet</a> -
   <a href="https://github.com/Lucostus">Constantin (Cleo) Winkler</a> -
   <a href="https://github.com/jcorentin">Corentin J.</a> -
   <a href="https://github.com/sdaigo">Daigo Shitara</a> -
@@ -112,7 +113,6 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/diemogebhardt">Diemo Gebhardt</a> -
   <a href="https://github.com/dmmulroy">Dillon Mulroy</a> -
   <a href="https://github.com/gothy">Dima Utkin</a> -
-  <a href="https://github.com/poroh">Dmitry Poroh</a> -
   <a href="https://github.com/DoctorCobweb">DoctorCobweb</a> -
   <a href="https://github.com/floodfx">Donnie Flood</a> -
   <a href="https://github.com/dbanty">Dylan Anthony</a> -
@@ -136,7 +136,7 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/evanasse">evanasse</a> -
   <a href="https://github.com/fabridamicelli">Fabrizio Damicelli</a> -
   <a href="https://github.com/fmesteban">Fede Esteban</a> -
-  <a href="https://github.com/yerTools">Felix Mayer</a> -
+  <a href="https://github.com/yerTools">Felix</a> -
   <a href="https://github.com/nandofarias">Fernando Farias</a> -
   <a href="https://github.com/ffigiel">Filip Figiel</a> -
   <a href="https://github.com/floriank">Florian Kraft</a> -
@@ -153,6 +153,7 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/giacomocavalieri">Giacomo Cavalieri</a> -
   <a href="https://github.com/giovannibonetti">Giovanni Kock Bonetti</a> -
   <a href="https://github.com/GV14982">Graham Vasquez</a> -
+  <a href="https://github.com/YoyoSaur">Grant Everett</a> -
   <a href="https://github.com/nirev">Guilherme de Maio</a> -
   <a href="https://github.com/guillheu">Guillaume Heu</a> -
   <a href="https://github.com/ghivert">Guillaume Hivert</a> -
@@ -175,13 +176,10 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/ianmjones">Ian M. Jones</a> -
   <a href="https://github.com/igordsm">Igor Montagner</a> -
   <a href="https://github.com/irumiha">Igor Rumiha</a> -
-  <a href="https://github.com/nilliax">ILLIA NEGOVORA</a> -
-  <a href="https://github.com/intarga">Ingrid</a> -
   <a href="https://github.com/inoas">inoas</a> -
   <a href="https://github.com/graphiteisaac">Isaac</a> -
   <a href="https://github.com/isaacharrisholt">Isaac Harris-Holt</a> -
   <a href="https://github.com/imcquee">Isaac McQueen</a> -
-  <a href="https://github.com/ismaelga">Ismael Abreu</a> -
   <a href="https://github.com/bozso">István Bozsó</a> -
   <a href="https://github.com/ivarvong">Ivar Vong</a> -
   <a href="https://github.com/jacobdalamb">Jacob Lamb</a> -
@@ -192,6 +190,7 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/jamesmacaulay">James MacAulay</a> -
   <a href="https://github.com/janpieper">Jan Pieper</a> -
   <a href="https://github.com/monzool">Jan Skriver Sørensen</a> -
+  <a href="https://github.com/hypirion">Jean Niklas L'orange</a> -
   <a href="https://github.com/MightyGoldenOctopus">Jean-Adrien Ducastaing</a> -
   <a href="https://github.com/jlgeering">Jean-Luc Geering</a> -
   <a href="https://github.com/okkdev">Jen Stehlik</a> -
@@ -202,7 +201,6 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/joeytrapp">Joey Trapp</a> -
   <a href="https://github.com/johan-st">Johan Strand</a> -
   <a href="https://github.com/JohnBjrk">John Björk</a> -
-  <a href="https://github.com/johngallagher">John Gallagher</a> -
   <a href="https://github.com/jmpavlick">John Pavlick</a> -
   <a href="https://github.com/jrstrunk">John Strunk</a> -
   <a href="https://github.com/xjojorx">Jojor</a> -
@@ -223,11 +221,12 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/hamptokr">Kramer Hampton</a> -
   <a href="https://github.com/Bearfinn">Kritsada Sunthornwutthikrai</a> -
   <a href="https://github.com/krystofrezac">Kryštof Řezáč</a> -
-  <a href="https://github.com/krzysztofgb">Krzysztof G.</a> -
+  <a href="https://github.com/krzysztofgb">Krzysztof Gasienica-Bednarz</a> -
   <a href="https://github.com/leostera">Leandro Ostera</a> -
   <a href="https://github.com/leejarvis">Lee Jarvis</a> -
   <a href="https://github.com/leonqadirie">Leon Qadirie</a> -
   <a href="https://github.com/LeartS">Leonardo Donelli</a> -
+  <a href="https://github.com/lexx27">Lexx</a> -
   <a href="https://github.com/defp">lidashuang</a> -
   <a href="https://github.com/LilyRose2798">Lily Rose</a> -
   <a href="https://github.com/nnuuvv">liv</a> -
@@ -274,7 +273,6 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/n8nio">n8n - Workflow Automation</a> -
   <a href="https://github.com/natanaelsirqueira">Natanael Sirqueira</a> -
   <a href="https://github.com/nathanielknight">Nathaniel Knight</a> -
-  <a href="https://github.com/Kuuuuuuuu">Nayuki</a> -
   <a href="https://github.com/NFIBrokerage">NFIBrokerage</a> -
   <a href="https://github.com/nchapman">Nick Chapman</a> -
   <a href="https://github.com/ndreynolds">Nick Reynolds</a> -
@@ -282,7 +280,6 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/NicoVIII">NicoVIII</a> -
   <a href="https://github.com/mrniket">Niket Shah</a> -
   <a href="https://github.com/blink1415">Nikolai Steen Kjosnes</a> -
-  <a href="https://github.com/ninanomenon">Ninaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a> -
   <a href="http://www.ninefx.com">NineFX</a> -
   <a href="https://github.com/nomio">Nomio</a> -
   <a href="https://github.com/oceanlewis">Ocean</a> -
@@ -358,7 +355,6 @@ Thank you to our sponsors! Gleam would not be possible without you.
   <a href="https://github.com/tomjschuster">Tom Schuster</a> -
   <a href="https://github.com/tomekowal">Tomasz Kowal</a> -
   <a href="https://github.com/tommaisey">tommaisey</a> -
-  <a href="https://github.com/ThisGuyCodes">Travis Johnson</a> -
   <a href="https://github.com/TristanCacqueray">Tristan de Cacqueray</a> -
   <a href="https://github.com/tsloughter">Tristan Sloughter</a> -
   <a href="https://github.com/lucamtudor">Tudor Luca</a> -
diff --git a/compiler-core/src/docs.rs b/compiler-core/src/docs.rs
index c170ce8b1..001e682bd 100644
--- a/compiler-core/src/docs.rs
+++ b/compiler-core/src/docs.rs
@@ -175,15 +175,6 @@ pub fn generate_html<IO: FileSystemReader>(
         let rendered_documentation =
             render_markdown(&documentation_content.clone(), MarkdownSource::Comment);
 
-        let functions: Vec<DocsFunction<'_>> = module
-            .ast
-            .definitions
-            .iter()
-            .filter(|statement| !statement.is_internal())
-            .flat_map(|statement| function(&source_links, statement))
-            .sorted()
-            .collect();
-
         let types: Vec<Type<'_>> = module
             .ast
             .definitions
@@ -193,12 +184,12 @@ pub fn generate_html<IO: FileSystemReader>(
             .sorted()
             .collect();
 
-        let constants: Vec<Constant<'_>> = module
+        let values: Vec<DocsValues<'_>> = module
             .ast
             .definitions
             .iter()
             .filter(|statement| !statement.is_internal())
-            .flat_map(|statement| constant(&source_links, statement))
+            .flat_map(|statement| value(&source_links, statement))
             .sorted()
             .collect();
 
@@ -234,9 +225,9 @@ pub fn generate_html<IO: FileSystemReader>(
                 reference: format!("{}.html#{}", module.name, type_.name),
             })
         });
-        constants.iter().for_each(|constant| {
+        values.iter().for_each(|constant| {
             search_items.push(SearchItem {
-                type_: SearchItemType::Constant,
+                type_: SearchItemType::Value,
                 parent_title: module.name.to_string(),
                 title: constant.name.to_string(),
                 content: format!(
@@ -248,20 +239,7 @@ pub fn generate_html<IO: FileSystemReader>(
                 reference: format!("{}.html#{}", module.name, constant.name),
             })
         });
-        functions.iter().for_each(|function| {
-            search_items.push(SearchItem {
-                type_: SearchItemType::Function,
-                parent_title: module.name.to_string(),
-                title: function.name.to_string(),
-                content: format!(
-                    "{}\n{}\n{}",
-                    function.signature,
-                    function.text_documentation,
-                    import_synonyms(&module.name, function.name)
-                ),
-                reference: format!("{}.html#{}", module.name, function.name),
-            })
-        });
+
         search_items.push(SearchItem {
             type_: SearchItemType::Module,
             parent_title: module.name.to_string(),
@@ -288,9 +266,8 @@ pub fn generate_html<IO: FileSystemReader>(
             module_name: EcoString::from(&name),
             file_path: &path.clone(),
             project_version: &config.version.to_string(),
-            functions,
             types,
-            constants,
+            values,
             rendering_timestamp: &rendering_timestamp,
         };
 
@@ -561,48 +538,6 @@ fn import_synonyms(parent: &str, child: &str) -> String {
     format!("Synonyms:\n{parent}.{child}\n{parent} {child}")
 }
 
-fn function<'a>(
-    source_links: &SourceLinker,
-    statement: &'a TypedDefinition,
-) -> Option<DocsFunction<'a>> {
-    let mut formatter = format::Formatter::new();
-
-    match statement {
-        Definition::Function(Function {
-            publicity: Publicity::Public,
-            name,
-            documentation: doc,
-            arguments: args,
-            return_type: ret,
-            location,
-            deprecation,
-            ..
-        }) => {
-            let (_, name) = name
-                .as_ref()
-                .expect("Function in a definition must be named");
-
-            Some(DocsFunction {
-                name,
-                documentation: markdown_documentation(doc),
-                text_documentation: text_documentation(doc),
-                signature: print(
-                    formatter
-                        .docs_fn_signature(Publicity::Public, name, args, ret.clone(), location)
-                        .group(),
-                ),
-                source_url: source_links.url(*location),
-                deprecation_message: match deprecation {
-                    Deprecation::NotDeprecated => "".to_string(),
-                    Deprecation::Deprecated { message } => message.to_string(),
-                },
-            })
-        }
-
-        _ => None,
-    }
-}
-
 fn text_documentation(doc: &Option<(u32, EcoString)>) -> String {
     let raw_text = doc
         .as_ref()
@@ -743,12 +678,43 @@ fn type_<'a>(source_links: &SourceLinker, statement: &'a TypedDefinition) -> Opt
     }
 }
 
-fn constant<'a>(
+fn value<'a>(
     source_links: &SourceLinker,
     statement: &'a TypedDefinition,
-) -> Option<Constant<'a>> {
+) -> Option<DocsValues<'a>> {
     let mut formatter = format::Formatter::new();
     match statement {
+        Definition::Function(Function {
+            publicity: Publicity::Public,
+            name,
+            documentation: doc,
+            arguments: args,
+            return_type: ret,
+            location,
+            deprecation,
+            ..
+        }) => {
+            let (_, name) = name
+                .as_ref()
+                .expect("Function in a definition must be named");
+
+            Some(DocsValues {
+                name,
+                definition: print(
+                    formatter
+                        .docs_fn_signature(Publicity::Public, name, args, ret.clone(), location)
+                        .group(),
+                ),
+                documentation: markdown_documentation(doc),
+                text_documentation: text_documentation(doc),
+                source_url: source_links.url(*location),
+                deprecation_message: match deprecation {
+                    Deprecation::NotDeprecated => "".to_string(),
+                    Deprecation::Deprecated { message } => message.to_string(),
+                },
+            })
+        }
+
         Definition::ModuleConstant(ModuleConstant {
             publicity: Publicity::Public,
             documentation: doc,
@@ -756,12 +722,13 @@ fn constant<'a>(
             value,
             location,
             ..
-        }) => Some(Constant {
+        }) => Some(DocsValues {
             name,
             definition: print(formatter.docs_const_expr(Publicity::Public, name, value)),
             documentation: markdown_documentation(doc),
             text_documentation: text_documentation(doc),
             source_url: source_links.url(*location),
+            deprecation_message: "".to_string(),
         }),
 
         _ => None,
@@ -778,16 +745,6 @@ struct Link {
     path: String,
 }
 
-#[derive(PartialEq, Eq, PartialOrd, Ord)]
-struct DocsFunction<'a> {
-    name: &'a str,
-    signature: String,
-    documentation: String,
-    text_documentation: String,
-    source_url: String,
-    deprecation_message: String,
-}
-
 #[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
 struct TypeConstructor {
     definition: String,
@@ -815,12 +772,13 @@ struct Type<'a> {
 }
 
 #[derive(PartialEq, Eq, PartialOrd, Ord)]
-struct Constant<'a> {
+struct DocsValues<'a> {
     name: &'a str,
     definition: String,
     documentation: String,
     text_documentation: String,
     source_url: String,
+    deprecation_message: String,
 }
 
 #[derive(Template)]
@@ -856,9 +814,8 @@ struct ModuleTemplate<'a> {
     pages: &'a [Link],
     links: &'a [Link],
     modules: &'a [Link],
-    functions: Vec<DocsFunction<'a>>,
     types: Vec<Type<'a>>,
-    constants: Vec<Constant<'a>>,
+    values: Vec<DocsValues<'a>>,
     documentation: String,
     rendering_timestamp: &'a str,
 }
@@ -886,8 +843,7 @@ struct SearchItem {
 #[derive(Serialize, PartialEq, Eq, PartialOrd, Ord, Clone)]
 #[serde(rename_all = "lowercase")]
 enum SearchItemType {
-    Constant,
-    Function,
+    Value,
     Module,
     Page,
     Type,
diff --git a/compiler-core/templates/documentation_module.html b/compiler-core/templates/documentation_module.html
index 3cccafb79..ff0e7c6ef 100644
--- a/compiler-core/templates/documentation_module.html
+++ b/compiler-core/templates/documentation_module.html
@@ -10,20 +10,11 @@
 </ul>
 {% endif %}
 
-{% if !constants.is_empty() %}
-<h2>Constants</h2>
+{% if !values.is_empty() %}
+<h2>Values</h2>
 <ul>
-  {% for constant in constants %}
-  <li><a href="#{{ constant.name }}">{{ constant.name }}</a></li>
-  {% endfor %}
-</ul>
-{% endif %}
-
-{% if !functions.is_empty() %}
-<h2>Functions</h2>
-<ul>
-  {% for function in functions %}
-  <li><a href="#{{ function.name }}">{{ function.name }}</a></li>
+  {% for value in values %}
+  <li><a href="#{{ value.name }}">{{ value.name }}</a></li>
   {% endfor %}
 </ul>
 {% endif %}
@@ -107,64 +98,36 @@
 </section>
 {% endif %}
 
-{% if !constants.is_empty() %}
+{% if !values.is_empty() %}
 <section class="module-members">
-  <h1 id="module-constants" class="module-member-kind">
-    <a href="#module-constants">Constants</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
-
-  {% for constant in constants %}
+  {% for value in values %}
   <div class="member">
     <div class="member-name">
-      <h2 id="{{ constant.name }}">
-        <a href="#{{ constant.name }}">
-          {{ constant.name }}
+      <h2 id="{{ value.name }}">
+        <a href="#{{ value.name }}">
+          {{ value.name }}
         </a>
       </h2>
-      {% if !constant.source_url.is_empty() %}
-      <a class="member-source" alt="View Source" title="View Source" href="{{ constant.source_url|safe }}">
+      {% if !value.source_url.is_empty() %}
+      <a class="member-source" alt="View Source" title="View Source" href="{{ value.source_url|safe }}">
         &lt;/&gt;
       </a>
       {% endif %}
     </div>
-    <pre><code class="hljs gleam">{{ constant.definition }}</code></pre>
-    <div class="rendered-markdown">{{ constant.documentation|safe }}</div>
-  </div>
-  {% endfor %}
-</section>
-{% endif %}
 
-{% if !functions.is_empty() %}
-<section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
-    <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
-  </h1>
-  {% for function in functions %}
-  <div class="member">
-    <div class="member-name">
-      <h2 id="{{ function.name }}">
-        <a href="#{{ function.name }}">
-          {{ function.name }}
-        </a>
-      </h2>
-      {% if !function.source_url.is_empty() %}
-      <a class="member-source" alt="View Source" title="View Source" href="{{ function.source_url|safe }}">
-        &lt;/&gt;
-      </a>
-      {% endif %}
-    </div>
-
-    <pre><code class="hljs gleam">{{ function.signature }}</code></pre>
-    {% if !function.deprecation_message.is_empty() %}
+    <pre><code class="hljs gleam">{{ value.definition }}</code></pre>
+    {% if !value.deprecation_message.is_empty() %}
     <p>
-      <b>Deprecated:</b> {{ function.deprecation_message }}
+      <b>Deprecated:</b> {{ value.deprecation_message }}
     </p>
     {% endif %}
-    <div class="rendered-markdown">{{ function.documentation|safe }}</div>
+    <div class="rendered-markdown">{{ value.documentation|safe }}</div>
   </div>
   {% endfor %}
 </section>
 {% endif %}
-{% endblock %}
+{% endblock %}
\ No newline at end of file


Test patch:
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__canonical_link.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__canonical_link.snap
index 7f5de6435..9af43d00b 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__canonical_link.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__canonical_link.snap
@@ -558,9 +558,7 @@ expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMar
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#one">one</a></li>
@@ -581,11 +579,9 @@ expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMar
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
@@ -926,9 +922,7 @@ expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMar
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#one">one</a></li>
@@ -949,11 +943,9 @@ expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMar
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__discarded_arguments_are_not_shown.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__discarded_arguments_are_not_shown.snap
index cf2eec1aa..f2383771e 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__discarded_arguments_are_not_shown.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__discarded_arguments_are_not_shown.snap
@@ -227,9 +227,7 @@ expression: "compile(config, modules)"
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#discard">discard</a></li>
@@ -250,11 +248,9 @@ expression: "compile(config, modules)"
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__docs_of_a_type_constructor_are_not_used_by_the_following_function.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__docs_of_a_type_constructor_are_not_used_by_the_following_function.snap
index afa1655d4..7de2c535d 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__docs_of_a_type_constructor_are_not_used_by_the_following_function.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__docs_of_a_type_constructor_are_not_used_by_the_following_function.snap
@@ -234,9 +234,7 @@ expression: "compile(config, modules)"
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#main">main</a></li>
@@ -321,11 +319,9 @@ expression: "compile(config, modules)"
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__hello_docs.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__hello_docs.snap
index 359129dc5..9fbc6d2d2 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__hello_docs.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__hello_docs.snap
@@ -227,9 +227,7 @@ expression: "compile(config, modules)"
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#one">one</a></li>
@@ -250,11 +248,9 @@ expression: "compile(config, modules)"
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__ignored_argument_is_called_arg.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__ignored_argument_is_called_arg.snap
index 0248634ff..cf6599668 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__ignored_argument_is_called_arg.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__ignored_argument_is_called_arg.snap
@@ -227,9 +227,7 @@ expression: "compile(config, modules)"
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#one">one</a></li>
@@ -250,11 +248,9 @@ expression: "compile(config, modules)"
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__internal_definitions_are_not_included.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__internal_definitions_are_not_included.snap
index 90dd493f1..c85183747 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__internal_definitions_are_not_included.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__internal_definitions_are_not_included.snap
@@ -228,8 +228,6 @@ expression: "compile(config, modules)"
 
 
 
-
-
       </nav>
 
       <main class="content">
@@ -244,8 +242,6 @@ expression: "compile(config, modules)"
 
 
 
-
-
       </main>
       <div class="search-overlay"></div>
     </div>
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__long_function_wrapping.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__long_function_wrapping.snap
index ab35456b6..b6d74d762 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__long_function_wrapping.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__long_function_wrapping.snap
@@ -234,9 +234,7 @@ expression: "compile(config, modules)"
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#lazy_or">lazy_or</a></li>
@@ -319,11 +317,9 @@ expression: "compile(config, modules)"
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_function_comment_is_trimmed.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_function_comment_is_trimmed.snap
index ad0ed4ccf..e63d1f79d 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_function_comment_is_trimmed.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_function_comment_is_trimmed.snap
@@ -227,9 +227,7 @@ expression: "compile(config, modules)"
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#indentation_test">indentation_test</a></li>
@@ -250,11 +248,9 @@ expression: "compile(config, modules)"
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_module_comment_is_trimmed.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_module_comment_is_trimmed.snap
index 97f30ed62..d0310c058 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_module_comment_is_trimmed.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__markdown_code_from_module_comment_is_trimmed.snap
@@ -228,8 +228,6 @@ expression: "compile(config, modules)"
 
 
 
-
-
       </nav>
 
       <main class="content">
@@ -248,8 +246,6 @@ expression: "compile(config, modules)"
 
 
 
-
-
       </main>
       <div class="search-overlay"></div>
     </div>
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__no_hex_publish.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__no_hex_publish.snap
index ce5d7b666..d269391fe 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__no_hex_publish.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__no_hex_publish.snap
@@ -544,9 +544,7 @@ expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMar
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#one">one</a></li>
@@ -567,11 +565,9 @@ expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMar
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
@@ -905,9 +901,7 @@ expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMar
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#one">one</a></li>
@@ -928,11 +922,9 @@ expression: "compile_with_markdown_pages(config, modules, pages,\nCompileWithMar
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__output_of_search_data_json.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__output_of_search_data_json.snap
index 81c17e7e8..9d27463f3 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__output_of_search_data_json.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__output_of_search_data_json.snap
@@ -2,4 +2,4 @@
 source: compiler-core/src/docs/tests.rs
 expression: json
 ---
-{"items":[{"type":"module","parentTitle":"gleam/option","title":"gleam/option","doc":"","ref":"gleam/option.html"},{"type":"type","parentTitle":"gleam/option","title":"Option","doc":"`Option` represents a value that may be present or not. `Some` means the value is present, `None` means the value is not.","ref":"gleam/option.html#Option"},{"type":"function","parentTitle":"gleam/option","title":"unwrap","doc":"Extracts the value from an `Option`, returning a default value if there is none.","ref":"gleam/option.html#unwrap"},{"type":"constant","parentTitle":"gleam/dynamic/decode","title":"bool","doc":"A decoder that decodes `Bool` values.\n\n # Examples\n\n \n let result = decode.run(dynamic.from(True), decode.bool)\n assert result == Ok(True)\n \n","ref":"gleam/dynamic/decode.html#bool"}],"proglang":"gleam"}
+{"items":[{"type":"module","parentTitle":"gleam/option","title":"gleam/option","doc":"","ref":"gleam/option.html"},{"type":"type","parentTitle":"gleam/option","title":"Option","doc":"`Option` represents a value that may be present or not. `Some` means the value is present, `None` means the value is not.","ref":"gleam/option.html#Option"},{"type":"value","parentTitle":"gleam/option","title":"unwrap","doc":"Extracts the value from an `Option`, returning a default value if there is none.","ref":"gleam/option.html#unwrap"},{"type":"value","parentTitle":"gleam/dynamic/decode","title":"bool","doc":"A decoder that decodes `Bool` values.\n\n # Examples\n\n \n let result = decode.run(dynamic.from(True), decode.bool)\n assert result == Ok(True)\n \n","ref":"gleam/dynamic/decode.html#bool"}],"proglang":"gleam"}
diff --git a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__tables.snap b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__tables.snap
index fdd6efe0f..a07e54352 100644
--- a/compiler-core/src/docs/snapshots/gleam_core__docs__tests__tables.snap
+++ b/compiler-core/src/docs/snapshots/gleam_core__docs__tests__tables.snap
@@ -227,9 +227,7 @@ expression: "compile(config, modules)"
 
 
 
-
-
-<h2>Functions</h2>
+<h2>Values</h2>
 <ul>
   
   <li><a href="#one">one</a></li>
@@ -250,11 +248,9 @@ expression: "compile(config, modules)"
 
 
 
-
-
 <section class="module-members">
-  <h1 id="module-functions" class="module-member-kind">
-    <a href="#module-functions">Functions</a>
+  <h1 id="module-values" class="module-member-kind">
+    <a href="#module-values">Values</a>
     <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
   </h1>
   
diff --git a/compiler-core/src/docs/tests.rs b/compiler-core/src/docs/tests.rs
index 945cf2a6d..86b3edceb 100644
--- a/compiler-core/src/docs/tests.rs
+++ b/compiler-core/src/docs/tests.rs
@@ -513,14 +513,14 @@ fn create_sample_search_data() -> SearchData {
                 reference: "gleam/option.html#Option".to_string(),
             },
             SearchItem {
-                type_: SearchItemType::Function,
+                type_: SearchItemType::Value,
                 parent_title: "gleam/option".to_string(),
                 title: "unwrap".to_string(),
                 content: "Extracts the value from an `Option`, returning a default value if there is none.".to_string(),
                 reference: "gleam/option.html#unwrap".to_string(),
             },
             SearchItem {
-                type_: SearchItemType::Constant,
+                type_: SearchItemType::Value,
                 parent_title: "gleam/dynamic/decode".to_string(),
                 title: "bool".to_string(),
                 content: "A decoder that decodes `Bool` values.\n\n # Examples\n\n \n let result = decode.run(dynamic.from(True), decode.bool)\n assert result == Ok(True)\n \n".to_string(),