partial-function

A Haskell coding rule that avoids functions which can crash for some inputs, such as empty lists or invalid text. It recommends returning an explicit result like Maybe instead.

In plain words
What is it for?
Use it when writing or reviewing Haskell code that reads lists, parses strings, accesses Maybe values, or uses indexes.
Why use it?
It reduces runtime crashes that type checking cannot catch and makes failures easier to handle predictably.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ncaq/konoka/partial-function
Any agent
npx skills add ncaq/konoka --skill partial-function
Clone the repo
git clone --depth 1 https://github.com/ncaq/konoka

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 672 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.00672
Opus 5 $0.00028 $0.00336
Sonnet 5 $0.00011 $0.00134
Haiku 4.5 $0.00006 $0.00067

Measured yesterday against content hash 8cf70d05ac2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

partial-function scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/haskell-tasuke/skills/partial-function/SKILL.md · 73 lines

What it actually says

部分関数の禁止

純粋関数であるにもかかわらず、 特定の入力に対して例外を投げる部分関数の使用は禁止します。

部分関数は型の上ではすべての入力を受け付けるように見えますが、 実際には一部の入力でしか正しく動作しません。 そのため型検査を通過しても実行時にクラッシュする原因になります。

純粋関数空間では安全な方法では例外を捕捉することが出来ないため、 エラーの処理が困難になります。

遅延評価と組み合わせると、 例外が発生するタイミングが予測できなくなり、 例外を捕捉しているはずなのに別の場所で評価された時に例外が発生することもあります。

全域関数や、 失敗をMaybeEitherなどで返す関数に置き換えてください。

代表的な部分関数と代替

fromJust

Maybeの中身を取り出しますが、 Nothingに対しては例外を投げます。

fromMaybeでデフォルト値を与えるか、 maybeやパターンマッチでNothingの場合を明示的に処理してください。

read

文字列をパースしますが、 失敗すると例外を投げます。

readMaybeや、 導入されていればreadMayを使い、 失敗をMaybeとして受け取ってください。

head / tail / init / last

空リストに対して例外を投げます。

先頭要素が欲しいだけならlistToMaybeやパターンマッチを使ってください。

導入されていればheadMayなどのMaybeを返すバージョンを使ってください。

空でないことが事前条件であるなら、 NonEmptyで型として表現すれば、 NonEmpty.headは全域関数になります。

(!!)

範囲外のインデックスに対して例外を投げます。

Data.List.(!?)のように、 Maybeを返す添字アクセスを使ってください。

そもそもリストの添字アクセスはパフォーマンスが悪いので、 可能な限り走査するようなコードを書いてください。

maximum / minimum / foldr1 / foldl1

空のコンテナに対して例外を投げます。

NonEmpty版を使うか、 初期値を与える安全なバージョンを使ってください。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 73 lines · 55 tokens per session scan A 8cf70d05ac2a

Subscribe to this mod's changes

partial-function is a skill published in the GitHub repository ncaq/konoka (3 stars, last pushed 3d ago), licensed Apache-2.0. It adds 55 tokens to every session and 672 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

ast-grep

Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for…

JanDeDobbeleer/oh-my-posh · 80 tokens

plano-agent-orchestration

Improve multi-agent orchestration in Plano. Use for agent registration, agent listener wiring, and capability-focused agent descriptions for accurate routing.

katanemo/plano · 33 tokens

plano-filter-guardrails

Harden Plano filter chains and guardrails. Use for MCP filter setup, prompt guard responses, and safe filter ordering.

katanemo/plano · 31 tokens

veo-3.2-prompter

Expert prompt engineering for Google Veo 3.2 (Artemis engine). Use when the user wants to generate a video with Veo 3.2, needs help crafting cinematic prompts, or mentions Veo, Google video generation, or Artemis engine.

pexoai/pexo-skills · 63 tokens

ads-linkedin

Audit LinkedIn Ads measurement, Insight Tag and conversions, professional audiences, lead generation, ABM, creative, bidding, budgets, pacing, automation, and policy. Use for LinkedIn Ads, Campaign Manager, Insight Tag, Lead Gen Forms, Thought Leader Ads, ABM campaigns, or B2B paid media.

AgriciDaniel/claude-ads · 68 tokens

military-commander

上将军·运筹帷幄 - 以兵法之道统筹全局,运筹帷幄之中,决胜千里之外,集中优势兵力打歼灭战.

linkerlin/PUAX · 52 tokens