Skip to content
Back to skills

String

ASecurity

Prefer Text over String for text data, and use ByteString for binary or non-Unicode data. Use when writing or reviewing Haskell code that handles strings, text, or byte data.

  • 3 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added May 27, 2026
data-ai

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add ncaq/konoka --skill string --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of String?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for String
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ncaq-string/badge)](https://www.skillsdirectory.com/skills/ncaq-string)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: string
description: Prefer Text over String for text data, and use ByteString for binary or non-Unicode data. Use when writing or reviewing Haskell code that handles strings, text, or byte data.
user-invocable: false
---

# 文字列型の使い分け

`String`は`[Char]`のエイリアスであり、
文字列を表現するために使われますが、
非常に非効率的です。

さらに`show`で表示したときに日本語を含むマルチバイト文字列がエスケープされます。

昔からある型のため仕方なく使われていますが、
なるべく`Text`を使ってください。

`Text`はUnicode文字列を効率的に扱える型です。
基本的には`Text.Lazy`ではなくStrictな`Text`を優先して使ってください。

`ByteString`との使い分けは、
Unicodeで正しく表現できる文字列の場合は`Text`を使い、
バイナリデータやエンコードが不明なデータ、
非Unicodeでやり取りされるネットワーク上の文字列データなどは`ByteString`を使います。

`String`は古くから使われているためライブラリに蔓延しているだけです。
ライブラリが関係するときだけ使い、
そのデータを長く使う場合は`Text`に変換するべきです。

詳しく知りたい場合は、
[Haskellの文字列型: 分類と特徴 - Qiita](https://qiita.com/mod_poppo/items/740659702f31216fdade)
を参照してください。

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.