Skip to content

Instantly share code, notes, and snippets.

@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
LoopInvariant (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 1 0) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 2 1)) (Lit (LitBool True /workspaces/gcl-all/gcl-vscode/example/bug.gcl [2-6] 1:3-7)) (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 7 6) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 8 7)) (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 9 8) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 12 11)) (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 12 11) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 13 12)) (Lit (LitInt 0 /workspaces/gcl-all/gcl-vscode/example/bug.gcl [13-14] 1:14-15)) (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 16 15) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 17 16)),Do (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 2 1 17) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 2 3 19)) (Head (GdCmd (Lit (LitBool False /workspaces/gcl-all/gc
@LCamel
LCamel / 0_fail.js
Last active August 7, 2025 21:53
mutual recursion
var MkIsOdd = (other) => ( (x) => x == 0 ? false : other(x - 1) );
var MkIsEven = (other) => ( (x) => x == 0 ? true : other(x - 1) );
// // doesn't work: isEven is undefined
// var isOdd = MkIsOdd(isEven), isEven = MkIsEven(isOdd);
// // the line above will be translated to something like:
var isOdd = undefined;
var isEven = undefined;
isOdd = MkIsOdd(isEven); // doesn't work: isEven is undefined
isEven = MkIsEven(isOdd);
@LCamel
LCamel / with version
Last active July 25, 2025 09:12
editTexts 的 callback 中, 即便晚了 10 秒再去 readSource, 讀到的也是舊的. 但隨後的 didChange 去讀就能讀到新的.
Jul 25 16:53:05 json: decoding request
Jul 25 16:53:05 JSON content: {"filePath":"/workspaces/gcl-all/gcl-vscode/example/gcd.gcl"}
Jul 25 16:53:05 json: decoding succeeded
Jul 25 16:53:05 Reload handler >>>> /workspaces/gcl-all/gcl-vscode/example/gcd.gcl
Jul 25 16:53:05 load: start
Jul 25 16:53:05 ask file state ref
Jul 25 16:53:05 ask file state map
Jul 25 16:53:05 lookup file state map
Jul 25 16:53:05 found
Jul 25 16:53:05 readSource: version: 3
@LCamel
LCamel / digHoles.log
Last active July 23, 2025 03:29
GCL digHoles: old source
json: decoding request
JSON content: {"filePath":"/workspaces/gcl-all/gcl-vscode/example/gcd_2.gcl"}
json: decoding succeeded
Reload handler >>>> /workspaces/gcl-all/gcl-vscode/example/gcd_2.gcl
load: start
ask file state ref
ask file state map
lookup file state map
found
source read
@LCamel
LCamel / node version
Created June 25, 2025 06:28
VS Code crashes sometimes
vscode ➜ /workspaces/gcl-all/gcl-vscode/example (main) $ /vscode/vscode-server/bin/linux-x64/18e3a1ec544e6907be1e944a94c496e302073435/node
Welcome to Node.js v22.15.1.
Type ".help" for more information.
>
@LCamel
LCamel / fullscreen1.sh
Last active February 19, 2025 14:09
Mac OS X fullscreen
#!/bin/sh
osascript -e 'tell application "System Events" to set frontApp to (name of first process whose frontmost is true)' -e 'tell application "System Events" to tell process frontApp to set position of window 1 to {0, 0}' -e 'tell application "System Events" to tell process frontApp to set size of window 1 to {1512, 3000}'
@LCamel
LCamel / a.html
Created February 6, 2025 07:21
a.html
<img src="https://lcamel.github.io/LCamel-Notes/LazyTower/level_digests.png" width="431px">