No slash command · from haskell-tasuke
Avoid partial functions such as head, fromJust, read, and (!!) in Haskell. Prefer total functions, Maybe-returning variants, and other safe alternatives. Use when writing or reviewing Haskell code that accesses lists, parses strings, or handles Maybe.
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.
純粋関数であるにもかかわらず、 特定の入力に対して例外を投げる部分関数の使用は禁止します。
部分関数は型の上ではすべての入力を受け付けるように見えますが、 実際には一部の入力でしか正しく動作しません。 そのため型検査を通過しても実行時にクラッシュする原因になります。
純粋関数空間では安全な方法では例外を捕捉することが出来ないため、 エラーの処理が困難になります。
遅延評価と組み合わせると、 例外が発生するタイミングが予測できなくなり、 例外を捕捉しているはずなのに別の場所で評価された時に例外が発生することもあります。
全域関数や、
失敗をMaybeやEitherなどで返す関数に置き換えてください。
Maybeの中身を取り出しますが、
Nothingに対しては例外を投げます。
fromMaybeでデフォルト値を与えるか、
maybeやパターンマッチでNothingの場合を明示的に処理してください。
文字列をパースしますが、 失敗すると例外を投げます。
readMaybeや、
導入されていればreadMayを使い、
失敗をMaybeとして受け取ってください。
空リストに対して例外を投げます。
先頭要素が欲しいだけならlistToMaybeやパターンマッチを使ってください。
導入されていればheadMayなどのMaybeを返すバージョンを使ってください。
空でないことが事前条件であるなら、
NonEmptyで型として表現すれば、
NonEmpty.headは全域関数になります。
範囲外のインデックスに対して例外を投げます。
Data.List.(!?)のように、
Maybeを返す添字アクセスを使ってください。
そもそもリストの添字アクセスはパフォーマンスが悪いので、 可能な限り走査するようなコードを書いてください。
空のコンテナに対して例外を投げます。
NonEmpty版を使うか、
初期値を与える安全なバージョンを使ってください。
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.