원클릭으로
hedgehog
Guidelines for property-based tests for Haskell using Hedgehog. Use when writing or reviewing property-based tests in Haskell.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Guidelines for property-based tests for Haskell using Hedgehog. Use when writing or reviewing property-based tests in Haskell.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Guides for Haskell code. Use when writing Haskell code.
Replace lens with microlens-* in Haskell packages
Security audit checklist for Rust code. Use when auditing Rust code for security vulnerabilities.
Re-generate Cabal freeze files.
Improve performance of Haskell code. Use when asked to profile or improve performance.
Reviews Haskell comments for Haddock markup opportunities. Use when reviewing or improving Haskell documentation comments.
| name | hedgehog |
| description | Guidelines for property-based tests for Haskell using Hedgehog. Use when writing or reviewing property-based tests in Haskell. |
if, unless, when) when preconditions
aren't met, use ==> or discard from Hedgehog.==.Ensure that every nontrivial typeclass instance has tests for each of the following properties:
Eq
x == xx == y ==> y == xx == y && y == z ==> x == zOrd
x <= y && y <= x ==> x == yx <= y && y <= z ==> x <= zx <= y || y <= xcompare x y == EQ ==> x == yEq1
liftEq (==) x y == (x == y)Ord1
liftCompare compare x y == compare x yHashable
x == y ==> hash x == hash yFunctor
fmap id == idfmap (f . g) == fmap f . fmap gApplicative
pure id <*> v == vpure (.) <*> u <*> v <*> w == u <*> (v <*> w)pure f <*> pure x == pure (f x)u <*> pure y == pure ($ y) <*> uMonad
return x >>= f == f xm >>= return == m(m >>= f) >>= g == m >>= (\x -> f x >>= g)Traversable
traverse Identity == Identitytraverse (Compose . fmap g . f) == Compose . fmap (traverse g) . traverse fBifunctor
bimap id id == idbimap (f . g) (h . i) == bimap f h . bimap g iBitraversable
bitraverse (Identity . f) (Identity . g) == Identity . bimap f gbitraverse (Compose . fmap g . f) (Compose . fmap i . h) == Compose . fmap (bitraverse g i) . bitraverse f hSemigroup
(x <> y) <> z == x <> (y <> z)Monoid
x <> mempty == xmempty <> x == x(x <> y) <> z == x <> (y <> z)Alternative
empty <|> x == xx <|> empty == x(x <|> y) <|> z == x <|> (y <|> z)MonadPlus
mzero >>= f == mzerom >> mzero == mzero| Property | Formula | When to Use |
|---|---|---|
| Roundtrip | decode(encode(x)) == x | Serialization, conversion pairs |
| Idempotence | f(f(x)) == f(x) | Normalization, formatting, sorting |
| Invariant | Property holds before/after | Any transformation |
| Commutativity | f(a, b) == f(b, a) | Binary/set operations |
| Associativity | f(f(a,b), c) == f(a, f(b,c)) | Combining operations |
| Identity | f(x, identity) == x | Operations with neutral element |
| Inverse | f(g(x)) == x | encrypt/decrypt, compress/decompress |
| Oracle | new_impl(x) == reference(x) | Optimization, refactoring |
| Easy to Verify | is_sorted(sort(x)) | Complex algorithms |
| No Exception | No crash on valid input | Baseline property |
Strength hierarchy (weakest to strongest): No Exception → Type Preservation → Invariant → Idempotence → Roundtrip