# idris-lang/idris2 architecture

> Architecture diagram of the GitHub repository idris-lang/idris2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/idris-lang/idris2
- Repository: https://github.com/idris-lang/idris2

## Overview

Idris 2 is a purely functional language with first-class types, but this tree contains only support/runtime code, not the compiler or language front end. The visible runtime capabilities are native C system and network services, RefC value operations, and JavaScript primitives and system bindings. An Idris program’s precise compile-and-run path is not established by these files, so the graph maps the available runtime layer rather than inventing that workflow. Relationships are limited to explicit calls or external APIs visible in sampled source; other listed capabilities are documented by file names and README context.

Main entry points: [`support/c/idris_support.c`](https://github.com/idris-lang/idris2/blob/main/support/c/idris_support.c) (System support), [`support/c/idris_file.c`](https://github.com/idris-lang/idris2/blob/main/support/c/idris_file.c) (File operations), [`support/c/windows/win_utils.c`](https://github.com/idris-lang/idris2/blob/main/support/c/windows/win_utils.c) (Windows helpers), [`support/refc/memoryManagement.c`](https://github.com/idris-lang/idris2/blob/main/support/refc/memoryManagement.c) (Values and memory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_native["Native C support"]
  node_c_support["System support<br/>[idris_support.c]"]
  node_c_file["File operations<br/>[idris_file.c]"]
  node_c_network["Network operations<br/>[idris_net.c]"]
  node_windows["Windows helpers<br/>[win_utils.c]"]
end

subgraph group_refc["RefC runtime"]
  node_refc_memory["Values and memory<br/>[memoryManagement.c]"]
  node_refc_math["Numeric operations<br/>[mathFunctions.h]"]
  node_refc_casts["Type casts<br/>[casts.h]"]
end

subgraph group_javascript["JavaScript support"]
  node_js_primitives["JS primitives<br/>[support.js]"]
  node_js_file["JS file support"]
  node_js_signal["JS signals"]
end

node_program(("Idris program"))
node_os(("Operating system"))
node_node(("Node.js APIs"))
node_network_os(("Socket services"))

node_c_support -->|"calls file I/O"| node_c_file
node_c_support -.->|"uses on Windows"| node_windows
node_c_file -.->|"uses on Windows"| node_windows
node_c_support -->|"accesses system services"| node_os
node_c_file -->|"accesses filesystem"| node_os
node_c_network -->|"calls socket APIs"| node_network_os
node_windows -->|"calls Windows APIs"| node_os
node_js_primitives -->|"provides primitives"| node_program
node_js_file -->|"uses filesystem and processes"| node_node
node_js_signal -->|"uses process signals"| node_node
node_refc_memory -->|"supports value operations"| node_refc_math
node_refc_memory -->|"supports value conversions"| node_refc_casts

click node_c_support "https://github.com/idris-lang/idris2/blob/main/support/c/idris_support.c"
click node_c_file "https://github.com/idris-lang/idris2/blob/main/support/c/idris_file.c"
click node_c_network "https://github.com/idris-lang/idris2/blob/main/support/c/idris_net.c"
click node_windows "https://github.com/idris-lang/idris2/blob/main/support/c/windows/win_utils.c"
click node_refc_memory "https://github.com/idris-lang/idris2/blob/main/support/refc/memoryManagement.c"
click node_refc_math "https://github.com/idris-lang/idris2/blob/main/support/refc/mathFunctions.h"
click node_refc_casts "https://github.com/idris-lang/idris2/blob/main/support/refc/casts.h"
click node_js_primitives "https://github.com/idris-lang/idris2/blob/main/support/js/support.js"
click node_js_file "https://github.com/idris-lang/idris2/blob/main/support/js/support_system_file.js"
click node_js_signal "https://github.com/idris-lang/idris2/blob/main/support/js/support_system_signal.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_c_support,node_c_file,node_c_network,node_windows toneBlue
class node_refc_memory,node_refc_math,node_refc_casts toneAmber
class node_js_primitives,node_js_file,node_js_signal,node_node toneMint
class node_program,node_os,node_network_os toneIndigo
```

## Components

### Native C support

- [System support](https://github.com/idris-lang/idris2/blob/main/support/c/idris_support.c): `support/c/idris_support.c`
- [File operations](https://github.com/idris-lang/idris2/blob/main/support/c/idris_file.c): `support/c/idris_file.c`
- [Network operations](https://github.com/idris-lang/idris2/blob/main/support/c/idris_net.c): `support/c/idris_net.c`
- [Windows helpers](https://github.com/idris-lang/idris2/blob/main/support/c/windows/win_utils.c): `support/c/windows/win_utils.c`

### RefC runtime

- [Values and memory](https://github.com/idris-lang/idris2/blob/main/support/refc/memoryManagement.c): `support/refc/memoryManagement.c`
- [Numeric operations](https://github.com/idris-lang/idris2/blob/main/support/refc/mathFunctions.h): `support/refc/mathFunctions.h`
- [Type casts](https://github.com/idris-lang/idris2/blob/main/support/refc/casts.h): `support/refc/casts.h`

### JavaScript support

- [JS primitives](https://github.com/idris-lang/idris2/blob/main/support/js/support.js): `support/js/support.js`
- [JS file support](https://github.com/idris-lang/idris2/blob/main/support/js/support_system_file.js): `support/js/support_system_file.js`
- [JS signals](https://github.com/idris-lang/idris2/blob/main/support/js/support_system_signal.js): `support/js/support_system_signal.js`

### Other components

- **Idris program**
- **Operating system**
- **Node.js APIs**
- **Socket services**

## Connections

- System support → File operations: calls file I/O
- System support → Windows helpers: uses on Windows
- File operations → Windows helpers: uses on Windows
- System support → Operating system: accesses system services
- File operations → Operating system: accesses filesystem
- Network operations → Socket services: calls socket APIs
- Windows helpers → Operating system: calls Windows APIs
- JS primitives → Idris program: provides primitives
- JS file support → Node.js APIs: uses filesystem and processes
- JS signals → Node.js APIs: uses process signals
- Values and memory → Numeric operations: supports value operations
- Values and memory → Type casts: supports value conversions
