himari: A standard library for Haskell as an alternative to rio

[ apache, control, library ] [ Propose Tags ] [ Report a vulnerability ]

A standard library for Haskell inspired by rio. Unlike rio, himari uses the full lens library instead of microlens, and provides hlint rules to warn against partial functions instead of providing safe wrapper modules. See the README at https://github.com/ncaq/himari#readme for more information.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0.1, 1.0.0.2
Change log CHANGELOG.md
Dependencies aeson (>=2.2.3.0 && <2.3), aeson-pretty (>=0.8.10 && <0.9), base (>=4.19.2.0 && <4.22), bytestring (>=0.12.2.0 && <0.13), containers (>=0.7 && <0.8), convertible (>=1.1.1.1 && <1.2), deepseq (>=1.5.0.0 && <1.6), deriving-aeson (>=0.2.10 && <0.3), exceptions (>=0.10.9 && <0.11), filepath (>=1.5.4.0 && <1.6), hashable (>=1.5.0.0 && <1.6), lens (>=5.3.5 && <5.4), monad-logger (>=0.3.42 && <0.4), mtl (>=2.3.1 && <2.4), pretty-simple (>=4.1.3 && <4.2), primitive (>=0.9.1.0 && <0.10), safe (>=0.3.21 && <0.4), text (>=2.1.2 && <2.2), time (>=1.12.2 && <1.13), typed-process (>=0.2.13.0 && <0.3), unliftio (>=0.2.25.1 && <0.3), unordered-containers (>=0.2.20 && <0.3), vector (>=0.13.2.0 && <0.14) [details]
Tested with ghc ==9.10.2, ghc ==9.10.3, ghc ==9.12.2
License Apache-2.0
Copyright ncaq
Author ncaq
Maintainer ncaq@ncaq.net
Category Control
Home page https://github.com/ncaq/himari
Bug tracker https://github.com/ncaq/himari/issues
Source repo head: git clone https://github.com/ncaq/himari.git
Uploaded by ncaq at 2026-01-03T01:55:03Z
Distributions
Downloads 6 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for himari-1.0.0.2

[back to package description]

himari

CI License

Haskell Hackage Haddock

Linux macOS Windows

A standard library for Haskell to replace rio

注意

[!IMPORTANT] himariはrioとは完全に同じように使えるわけではありません。 ここで主な注意点を挙げます。

重大なランタイムの非互換性

ログの出力先の変更

rioは基本的に標準出力にログを出力しますが、 himariはデフォルトのガイドラインに従うと標準エラー出力にログを出力します。

ログは標準エラー出力に出すべきだと考えているためです。

変更したい時は出力先をstderrからstdoutなどに変更することで簡単に変更可能です。

部分関数への対処方法の違い

rioは部分関数を独自のモジュールでexportして提供していますが、 himariはそのままオリジナルのモジュールを使ってもらいます。

よってhimariは部分関数を除去していません。

なのでhimariはhlintのルールで警告を出すことで対処しています。

プロジェクトルートにある.hlint.yamlファイルを、 以下のような方法であなたのプロジェクトにコピーしてください。

curl -L 'https://raw.githubusercontent.com/ncaq/himari/master/.hlint.yaml' -o '.hlint.yaml'

背景

私は、 commercialhaskell/rio: A standard library for Haskell の思想が好みで長く使っています。

しかしrioの好みではない点もいくつかあります。 単純に質の問題であれば私がコントリビュートすれば良いのですが、 非互換な選択である部分が多いため、 それは受け入れられないだろうと考えて、 rioに似たライブラリであるhimariを作成することにしました。

目標

依存関係が大きくなることを恐れない

rioは依存関係を小さくしようと考えているのか、 lens: Lenses, Folds and Traversals ではなく、 microlens: A tiny lens library with no dependencies を採用しています。

しかし実際のライブラリでは本家のlensに依存していることも多く、 結局使おうとしてコンフリクトすることが多いです。

Haskellは静的にビルドする言語なので、 依存関係が多いことはあまり怖くありません。

使うとは限らない依存関係もドシドシimportしてしまいます。

バージョンごとの依存関係の解決が大変なのはNixなどのパッケージマネージャのレイヤーで解決することにします。

なるべく一行で済ませたい

himariは基本的には以下の一行で代替Preludeを提供することを目指します。

import Himari

色々と書くのは面倒ですからね。 これで衝突しない範囲はたくさんimportしてしまいます。

同じシンボル名をexportしていて衝突してしまうものは仕方がないのでqualified importを使ってもらいます。

なるべく独自のシンボルを定義しない

himariはrioで言うRIO.Textのような独自のシンボルを定義することをなるべく避けます。 LLMのコーディングエージェントに独自のシンボルを使うことを守ってもらうのが難しいからです。 しばしばオリジナルのシンボルをimportしてしまいます。

ただしHimari.Preludeのサブモジュール(Himari.Prelude.Aesonなど)は例外的に存在します。 これはHaddockの制限により、hidingを使ったre-exportはシンボルが全て展開されてドキュメントが肥大化してしまうためです。 サブモジュールでhidingを隠蔽することで、Himari.Preludeのドキュメントをコンパクトに保っています。

これらのサブモジュールはHimari.Preludeから自動的にre-exportされるため、 rioのRIO.Textのように個別にimportする必要はありません。 万が一誤ってサブモジュールを直接importした場合でも、 Himari.Preludeと重複importすることになり、GHCが警告を出してくれます。

Nix

このプロジェクトはhaskell.nixを使用しています。

nix flake showが失敗する場合

haskell.nixはIFD(Import From Derivation)を使用するため、 複数システムをサポートするflakeでnix flake showを実行すると、 異なるシステム向けのビルドを評価しようとして失敗することがあります。

これはhaskell.nixの既知の制限であり、 現在のところ完全な回避策はありません。