$argon2id$v=19$m=512,t=256,p=1$gw0nMXKedsmEA5rZ6Fv23w$Rc69s3MGERPKFCyiChyBeikFwh6R2WNordBaWd6f6rk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open import Data.Nat using (ℕ; _+_) | |
| open import Data.Bool using (Bool; true; false) | |
| open import Data.List using (List; []; _∷_) | |
| open import Data.Product using (_×_; _,_) | |
| open import Data.Unit using (⊤; tt) | |
| -- #region Types, Contexts, and Environments | |
| data Ty : Set where | |
| NatTy : Ty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| -- #region imports | |
| import Data.Aeson (ToJSON) | |
| import Data.OpenApi (OpenApi, ToSchema) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -------------------------------- | |
| -- Embedding and Projecting | |
| -------------------------------- | |
| -- | Embedding and projection between `a` and `b`. Note that `project` can fail. | |
| data EP a b = EP | |
| { embed :: a -> b, | |
| project :: b -> Maybe a | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open import Reflection | |
| open import Data.Unit | |
| open import Data.List | |
| -------------------------------- | |
| -- "apply" macro | |
| -------------------------------- | |
| -- Helper function for `apply` macro. | |
| -- This function structurally recurses on `φ` (the type of `f`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "maud-example-fuzzy-filter-list" | |
| version = "0.1.0" | |
| edition = "2024" | |
| [dependencies] | |
| anyhow = "1.0.100" | |
| maud = "0.27.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {- | |
| This module demonstrates a neat feature in Haskell that I commonly use in TypeScript. | |
| For example, in TypeScript, I often do something like this: | |
| ``` | |
| type Person | |
| = { name: string } | |
| & ( { isAnnotated: false } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { do_ } from "@/utility"; | |
| type Newtype<R extends object, S extends keyof R, T> = R[S] extends void | |
| ? R & T | |
| : never; | |
| const X1: unique symbol = Symbol(); | |
| type X1 = Newtype<{ [X1]: void }, typeof X1, number>; | |
| const X2: unique symbol = Symbol(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const serve_dir = "docs" | |
| const port = 8000; | |
| Bun.serve({ | |
| port, | |
| async fetch(req) { | |
| const url_str = req.url.endsWith("/") ? `${req.url}index.html` : req.url | |
| const url = new URL(url_str); | |
| const filePath = `${serve_dir}${url.pathname}`; | |
| console.log(`GET ${filePath}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Solution 2: using breadth-first search | |
| module Main where | |
| import Prelude | |
| import Data.Array as Array | |
| import Data.Foldable (foldM, traverse_) | |
| import Data.Traversable (traverse) | |
| import Data.Tuple.Nested ((/\)) |
NewerOlder