template-haskell · git:20260521.951213f · 2026-05-21 · sha256 6419b49523c25697

template-haskell git:20260521.951213fA

Immutable. This exact content never changes and is served at /api/v1/blob/6419b49523c25697.

---
name: template-haskell
description: Distinguish mkName and newName in Template Haskell. Use mkName to capture existing names and newName for fresh non-colliding names. Use when writing or reviewing Template Haskell code that generates names.
user-invocable: false
---

# [template-haskell: Support library for Template Haskell](https://hackage.haskell.org/package/template-haskell)

## Template Haskellの`mkName`と`newName`の使いかた

既にスコープに存在する名前をキャプチャする形で参照したい時は`mkName`を使います。

新しいフレッシュな衝突しない名前を生成したい時は`newName`を使います。

キャプチャする必要がある場合は`mkName`、
そうでなければ安全な`newName`を使うべきです。