Skip to content

Instantly share code, notes, and snippets.

@LCamel
LCamel / orphan.txt
Created March 20, 2026 02:01
orphan
● 分析完成。252 個 orphan instances 分佈在 28 個檔案,可以分成三大類:
---
結論:大部分 orphan 是架構上難以避免的
1. 結構上必要的 orphan(~100+ 個)— 不建議動
Pretty / Render instances 是最大宗。原因是經典的循環依賴問題:
Syntax/Abstract/Types.hs 定義 Expr, Stmt, Type ...
-- NextDidChange.csp
-- FDR4 model to verify the NextDidChange property of the GCL Server-Edit protocol.
--
-- Reference: https://github.com/scmlab/gcl-all/wiki/Server-Edit
--
-- Property (NextDidChange):
-- If workspace/applyEdit succeeds (client applied the edit),
-- then the next textDocument/didChange the server receives
-- belongs to that edit.
--
@LCamel
LCamel / Load2.hs
Created February 26, 2026 06:59
Load2.hs
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
module Server.Load2 where
import Data.IntMap (IntMap)
import Data.Text (Text)
import Error (Error (..))
import GCL.Predicate (Hole, PO, Spec)
import GCL.Range (Range)
@LCamel
LCamel / a.sh
Last active February 9, 2026 16:32
xpra
cp -rL /usr/share/xpra $HOME/xpra_copy
sed -i 's/getboolparam("swap_keys", Utilities\.isMacOS())/getboolparam("swap_keys", false)/' \
"$HOME/xpra_copy/www/index.html"
xpra start --bind-tcp=0.0.0.0:8080 --html=$HOME/xpra_copy/www --start=emacs-lucid
@LCamel
LCamel / 0.txt
Last active January 30, 2026 02:59
GCL early load
% grep Trace /tmp/a.txt
[Trace - 2:45:29 AM] Sending request 'initialize - (0)'.
[Trace - 2:45:29 AM] Received response 'initialize - (0)' in 7ms.
[Trace - 2:45:29 AM] Sending notification 'initialized'.
[Trace - 2:45:29 AM] Sending notification 'textDocument/didOpen'.
[Trace - 2:45:29 AM] Sending request 'gcl/reload - (1)'.
[Trace - 2:45:29 AM] Received request 'client/registerCapability - (1)'.
[Trace - 2:45:29 AM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
[Trace - 2:45:29 AM] Sending notification 'workspace/didChangeConfiguration'.
[Debug] VFS: opening file:///workspaces/gcl[Trace - 2:45:29 AM] Received request 'workspace/configuration - (2)'.
@LCamel
LCamel / keybindings.json
Created January 15, 2026 13:43
VS Code terminal key mapping: user_data_dir/User/keybindings.json
[
{
"key": "shift+enter",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u001b\r"
},
"when": "terminalFocus"
}
]
@LCamel
LCamel / yt_thumb.sh
Created January 15, 2026 13:38
yt_thumb.sh
#!/bin/bash
# Usage: ./yt_thumb.sh VIDEO_ID [WIDTH] [OUTPUT_FILE]
# Example: ./yt_thumb.sh hcx0SSvk7zg 480 thumbnail.jpg
VIDEO_ID="$1"
WIDTH="${2:-}"
OUTPUT="${3:-yt_thumb_${VIDEO_ID}.jpg}"
if [ -z "$VIDEO_ID" ]; then
@LCamel
LCamel / a.md
Created November 21, 2025 09:55
GCL line column offset Loc Range coordinate

如果我們把 Lexer.hs 中的 translateLoc 和 update 改成

import Debug.Trace (trace)
...

    translateLoc (TsToken (L loc x) rest) = TsToken (L (update' loc x) x) (translateLoc rest)
      where
        update' NoLoc x = NoLoc
        update' before@(Loc start (Pos path l c co)) x = result'
          where result = Loc start (Pos path l (c + 1) (co + 1))
@LCamel
LCamel / discuss.txt
Created October 19, 2025 12:51
vscode haskell extension / ghcup
╭─── Claude Code v2.0.22 ─────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back LCamel! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ ▐▛███▜▌ │ Recent activity │
│ ▝▜█████▛▘ │ No recent activity │
│ ▘▘ ▝▝ │ │
│ │ │
│ Sonnet 4.5 · Claude Pro │ │
│ /Users/lcamel/vc/vscode-haskell │
@LCamel
LCamel / hls.py
Created October 19, 2025 12:31
find hls by ghc version
#!/usr/bin/env python3
# % python3 hls.py 9.8.4 | grep -i Unknown
# "2.10.0.0", "A_64", "Linux_UnknownLinux"
# "2.10.0.0", "A_ARM64", "Linux_UnknownLinux"
# "2.11.0.0", "A_64", "Linux_UnknownLinux"
# "2.11.0.0", "A_ARM64", "Linux_UnknownLinux"
import sys
import json