No slash command · from haskell-tasuke
Use the lens library, generating accessors with makeFieldsId for NoFieldSelectors records, export accessors together with their type classes, and prefer lens or OverloadedRecordDot over pattern matching. Use when writing or reviewing Haskell code that uses lens, records, or field access.
Ships in haskell-tasuke. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
makeFieldsIdNoFieldSelectorsを前提に定義したデータ構造に対して、
lensのレコードのフィールドアクセサを定義する時は、
makeFieldsIdというTemplate Haskell関数を使ってください。
makeFieldsIdを使うときはフィールドにプレフィクスやアンダースコアは付けないでください。
NoFieldSelectors拡張の力でプレフィクスは不要になっています。
makeFieldsId関数は完全にフィールド名と同じアクセサを生成するので、
プレフィクスやアンダースコアをつけると奇妙なアクセサが生成されてしまうのでむしろよくありません。
makeFieldsIdは実行する段階で既に型クラスの定義が見えているならば、
型クラスの重複定義はせず既に存在する型クラスのインスタンスとしてアクセサを定義します。
そのため型クラスの重複を怖がってimportを少なくする必要はありません。 むしろ積極的に既存の型クラスをimportしてください。
循環参照が発生した場合は型クラスの定義だけを別のモジュールに分割して、 双方それをimportしてください。
makeFieldsサードパーティのデータ構造や自動生成されたデータ構造に対しては、
プレフィクスやアンダースコアがあるかどうかを考慮して、
makeFieldsなどの他のTemplate Haskell関数を使ってください。
例えばmakeFieldsIdでHasUser型クラスとuserアクセサを定義した場合、
userアクセサをexportするのではなく、
HasUser型クラスを内部のアクセサも含めてexportしてください。
OverloadedRecordDotを使うパターンマッチを使ってレコードのフィールドにアクセスすると、
どうしてもshadowing警告が発生しやすくなります。
そのためlensかOverloadedRecordDotを使ってフィールドにアクセスしてください。
データ型のフィールド名と同じ変数を定義すると、 しばしばlensのアクセサによってshadowing警告が発生します。
そのためNamedFieldPunsは実質使えないと考えてください。
単にフィールドを設定する場合はlensのSetterを使ってください。
初期化時などlensが使えない場合は、
フィールド名に'をつけた変数名を使ってください。
例えばfooフィールドの場合foo'変数を定義して、
最終的に以下のように代入に使います。
{ foo = foo' }
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub ncaq/konoka --plugin haskell-tasuke19 skills in this plugin
/bracketUse bracket or with-style functions to guarantee resource cleanup even on exceptions instead of separate do blocks. Use when writing or reviewing Haskell code that acquires and releases resources./bump-cabal-index-stateUpdate Cabal project index-state to the latest timestamp. Use when it needs to bump the cabal index-state./cabal-commandUse cabal with --disable-optimization for development builds and tests, and add --enable-tests to avoid rebuilds. Use when running or suggesting cabal build or test commands in Haskell development./exceptionDo not throw exceptions from pure code with error or throw, give exceptions structured types, and never silently swallow errors in IO. Use when writing or reviewing Haskell error handling, exceptions, or IO code./exportExplicitly enumerate Haskell module exports instead of exporting everything implicitly, and use re-export sparingly. Use when writing or reviewing Haskell module export lists./function-resultDo not discard a function's final value with return (), pure (), or void; adjust the type to return the value and let the caller discard it when unneeded. Use when writing or reviewing Haskell functions that return unit or discard results.