2023-06-25 12:59:18 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2024-01-14 00:08:57 +00:00
|
|
|
|
2023-06-25 12:59:18 +00:00
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>THP: Typed Hypertext Processor</title>
|
|
|
|
|
|
|
|
<!-- Tailwind output -->
|
|
|
|
<link href="/css/out.css" rel="stylesheet">
|
2023-06-27 03:11:02 +00:00
|
|
|
<link rel="stylesheet" href="/css/xcode-colors.css">
|
2023-06-25 12:59:18 +00:00
|
|
|
|
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
2024-01-14 00:08:57 +00:00
|
|
|
<link
|
2024-03-26 23:05:58 +00:00
|
|
|
href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600;700;800;900&family=Fira+Code&display=swap"
|
2024-01-14 00:08:57 +00:00
|
|
|
rel="stylesheet">
|
2024-04-05 14:09:06 +00:00
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
|
2023-06-25 12:59:18 +00:00
|
|
|
</head>
|
2024-01-14 00:08:57 +00:00
|
|
|
|
2023-06-25 12:59:18 +00:00
|
|
|
<body class="bg-c-bg text-c-text">
|
2024-01-14 00:08:57 +00:00
|
|
|
<nav class="sticky top-0 h-12 border-b border-[rgba(150,150,150,0.25)] bg-c-nav-bg backdrop-blur-md z-20">
|
|
|
|
<div class="container mx-auto h-full w-full flex items-center">
|
2024-04-05 14:09:06 +00:00
|
|
|
<a href="/" class="inline-block px-4 font-display font-black text-2xl hover:underline">
|
2024-01-14 00:08:57 +00:00
|
|
|
<span class="text-[#F5A9B8]">t</span><span>h</span><span class="text-[#5BCEFA]">p</span>
|
2024-03-28 01:55:35 +00:00
|
|
|
</a>
|
2024-04-05 14:09:06 +00:00
|
|
|
<a href="/learn/" class="hidden lg:inline-block px-4 font-display font-bold-text-xl hover:underline">
|
|
|
|
Learn
|
|
|
|
</a>
|
|
|
|
<a href="/how-to/" class="hidden lg:inline-block px-4 font-display font-bold-text-xl hover:underline">
|
|
|
|
How to guides
|
|
|
|
</a>
|
|
|
|
<a href="/reference/" class="hidden lg:inline-block px-4 font-display font-bold-text-xl hover:underline">
|
|
|
|
Language reference
|
|
|
|
</a>
|
|
|
|
<a href="/api/" class="hidden lg:inline-block px-4 font-display font-bold-text-xl hover:underline">
|
|
|
|
Stdlib API
|
|
|
|
</a>
|
|
|
|
</div>
|
2023-10-02 01:41:38 +00:00
|
|
|
</nav>
|
2023-07-01 01:55:29 +00:00
|
|
|
|
2024-04-05 14:09:06 +00:00
|
|
|
<div class="container mx-auto lg:py-16 py-2 lg:grid 2xl:grid-cols-[auto_32rem] lg:grid-cols-[auto_36rem] gap-4 lg:px-10 px-2">
|
|
|
|
<div class="lg:pl-10 table">
|
2024-03-23 23:32:27 +00:00
|
|
|
<div class="table-cell align-middle">
|
2024-04-05 14:09:06 +00:00
|
|
|
<h1 class="font-display font-bold text-c-text-2 lg:text-5xl text-3xl lg:text-left text-center leading-tight">
|
2024-03-23 23:32:27 +00:00
|
|
|
A modern, type safe,
|
2024-04-05 14:09:06 +00:00
|
|
|
<br class="hidden lg:inline-block">
|
2024-03-23 23:32:27 +00:00
|
|
|
secure language
|
2024-04-05 14:09:06 +00:00
|
|
|
<br class="hidden lg:inline-block">
|
2024-03-23 23:32:27 +00:00
|
|
|
compiled to PHP
|
|
|
|
</h1>
|
2024-04-05 14:09:06 +00:00
|
|
|
<p class="font-display text-c-text text-xl pt-6 lg:pr-12">
|
2024-03-23 23:32:27 +00:00
|
|
|
Inspired by Rust, Zig and Swift, THP has a modern syntax, semantics,
|
|
|
|
type system and stdlib.
|
|
|
|
</p>
|
2023-09-15 03:15:35 +00:00
|
|
|
<br>
|
2024-02-20 10:17:21 +00:00
|
|
|
<br>
|
2024-03-23 23:32:27 +00:00
|
|
|
<div class="text-center">
|
2024-03-28 01:55:35 +00:00
|
|
|
<a class="inline-block font-display text-lg rounded-full border-2 border-pink-400 py-2 px-8
|
2024-03-28 23:03:16 +00:00
|
|
|
transition-colors hover:text-black hover:bg-pink-400" href="/learn/">
|
2024-03-28 01:55:35 +00:00
|
|
|
Tutorial
|
2024-03-26 23:29:52 +00:00
|
|
|
</a>
|
2024-03-23 23:32:27 +00:00
|
|
|
|
2024-03-28 01:55:35 +00:00
|
|
|
<a class="inline-block font-display text-lg border-2 border-sky-400 py-2 px-8 mx-6 rounded-full
|
|
|
|
transition-colors hover:text-black hover:bg-sky-400" href="/install/">
|
2024-03-26 23:29:52 +00:00
|
|
|
Install
|
|
|
|
</a>
|
2024-03-28 01:55:35 +00:00
|
|
|
|
2024-03-23 23:32:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-06-25 12:59:18 +00:00
|
|
|
</div>
|
|
|
|
|
2024-04-05 14:09:06 +00:00
|
|
|
<div class="bg-[var(--code-theme-bg-color)] lg:p-6 p-2 rounded-lg relative">
|
|
|
|
<span class="absolute lg:inline-block hidden h-[35rem] w-[35rem] -z-10 top-1/2 left-1/2 rounded-full
|
2024-01-14 00:08:57 +00:00
|
|
|
transform -translate-x-1/2 -translate-y-1/2" style="background-image: conic-gradient(from 180deg at 50% 50%,#5BCEFA 0deg,#a853ba 180deg,#F5A9B8 1turn);
|
|
|
|
filter: blur(75px); opacity: 0.75;">
|
2023-10-02 01:41:38 +00:00
|
|
|
</span>
|
|
|
|
|
2024-01-14 00:08:57 +00:00
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14">
|
|
|
|
<g fill="none" fill-rule="evenodd" transform="translate(1 1)">
|
|
|
|
<circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle>
|
|
|
|
<circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle>
|
|
|
|
<circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle>
|
|
|
|
</g>
|
|
|
|
</svg>
|
|
|
|
<div class="h-1"></div>
|
2024-03-26 23:29:52 +00:00
|
|
|
<div id="editor" class="font-mono language-thp"></div>
|
2024-01-14 00:08:57 +00:00
|
|
|
</div>
|
2023-06-25 12:59:18 +00:00
|
|
|
</div>
|
2023-09-15 03:15:35 +00:00
|
|
|
|
2024-03-26 23:29:52 +00:00
|
|
|
<script src="/js/highlighter.js"></script>
|
2024-03-26 23:05:58 +00:00
|
|
|
<script>
|
2024-03-26 23:29:52 +00:00
|
|
|
let jar = CodeJar(document.getElementById("editor"), thp_highlighter, {
|
|
|
|
tab: " ",
|
|
|
|
});
|
|
|
|
|
|
|
|
jar.updateCode(
|
2024-03-27 17:01:14 +00:00
|
|
|
`// Actual generics & sum types
|
2024-03-26 23:29:52 +00:00
|
|
|
fun find_person(Int person_id) -> Result[String, String] {
|
|
|
|
// Easy, explicit error bubbling
|
|
|
|
try Person::find_by_id(person_id)
|
|
|
|
}
|
|
|
|
|
|
|
|
val id = POST::get("person_id") ?? exit("Null person_id")
|
|
|
|
// Errors as values
|
|
|
|
val person = try find_person(person_id: id) with error {
|
|
|
|
eprint("Error: {error}")
|
|
|
|
exit("Person not found")
|
|
|
|
}
|
|
|
|
|
|
|
|
// First class HTML-like templates & components
|
|
|
|
print(
|
|
|
|
<a href="/person/reports/{person.id}">
|
|
|
|
welcome, {person.name}
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
// And more!`
|
|
|
|
)
|
2024-03-26 23:05:58 +00:00
|
|
|
</script>
|
2023-06-25 12:59:18 +00:00
|
|
|
</body>
|
2024-01-14 00:08:57 +00:00
|
|
|
|
2024-04-05 14:09:06 +00:00
|
|
|
</html>
|