haskell-jp / questions #105

@ has joined the channel
data とレコード構文で定義した、一つだけコンストラクタを持つ型について、コンストラクタの各引数へのアクセサとなるLensを勝手に導出してくれるような方法はありますか?
... Replies ...
@ymorita has joined the channel
@Birudo Un has joined the channel
@lesguillemets has joined the channel
@Sato Naoto has joined the channel
以下の (f $ g) はどのように理解できますか?
ghci> let f = (1 +) :: (Num a) => a -> a
ghci> let g = (2 +) :: (Num a) => a -> a
ghci> :t (f $ g)
(f $ g) :: (Num a, Num (a -> a)) => a -> a

背景としては、以下のようにコンパイルエラーになる例を考えるつもりでした:
ghci> let a = (1 +) :: Int -> Int
ghci> let b = (2 +) :: Int -> Int
ghci> :t (a $ b)

<interactive>:1:6: error:
    • Couldn't match expected type 'Int' with actual type 'Int -> Int'
    • In the second argument of '($)', namely 'b'
      In the expression: a $ b
... Replies ...
Data.Sequenceを触っていた時に、ふとunconsやunsnocのような関数があれば便利かなと思ってcontainerで提案してみたのですが、viewlやviewr使えば実現できるのであまり本質的じゃない拡張っぽいみたいなレスポンスをもらいました(当然と言えば当然ですが)。

Data.Sequenceにunconsやunsnocがあったとしてどんなときに役立つか正直答えられる自信がないので、closeしようかなとも思っています。
このような既存の関数で表現できるような関数のライブラリへの必要性について皆さんはどう思いますでしょうか。お手柔らかにお願いします

https://github.com/haskell/containers/issues/977
... Replies ...
@Carlos Fontes has joined the channel
stack ベースのhaskell 環境で単体テストに HSpec を使用しています。
テストディレクトリ/Spec.hs に以下を指定していますが、haskell language server 経由で出るGHCエラー(下記)を消す方法がわかりません。
ご存知でしたら教えてください。

補足
コマンド行からの stack test 実行では問題ありません。
stack がインストールした hspec-discover の場所を haskell language server 設定のどこかで指定する必要があると推測しています。

エラー:
Spec.hs 1 1 error could not execute: hspec-discover (lsp)
Spec.hs:
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
... Replies ...
Hiromi ISHII / mr_konn
package.yaml の build-tool-depends に相当する項目は build-tools ですので、 @さんの対処法は(stack+build-toolsでは解決しないという点を除けば)完全に正当なものでは?

https://github.com/sol/hpack#common-fields
@kb2 kkb2 has joined the channel
@hk_slack2 has joined the channel
@ふぃえ has joined the channel
@qwfe43h has joined the channel
@峰岸零 has joined the channel
質問です
関数型プログラミングでdbアクセスしようとする時に、どうしても副作用が多いコードになってしまう気がします
何か良い例は無いでしょうか...?
... Replies ...
Rinat Stryungis
@Rinat Stryungis has joined the channel
@Cqug has joined the channel
@Katsy has joined the channel
absinthe drunker (atカフェ)
@absinthe drunker (atカフェ) has joined the channel
@jqoh has joined the channel
@CLERK has joined the channel
Hiroyuki Hirano
@Hiroyuki Hirano has joined the channel
@中村悠人 has joined the channel
@ymshita has joined the channel
@U5K has joined the channel
Kohei Kajikawa
@Kohei Kajikawa has joined the channel
結構前から開発するのに rio を使っているのですが、PR出せるか見てみたら最終コミットが去年1月になってるんですね
これ開発継続してますかね?みなさんもう知らぬ間に使ってなかったりします?
... Replies ...
気づいたら stack new が最新のlts-resolver urlを拾わなくなってるの。いつから、なにが変ったのでしょうか?
現在(2024-03-11)は、lts-22.13 が最新なんですが、stack new hoge すると
Selected the snapshot .

がでてきます。
... Replies ...
Hiromi ISHII / mr_konn
なんかいつからか S3 上にホストされている snapshots がアップデートされなくなっているんですよね。 に最新のデータがあるので、これをスナップショット一覧のデータになるように stack を再設定すればいいはずです
Hiromi ISHII / mr_konn
https://docs.haskellstack.org/en/stable/yaml_configuration/#urls ここの説明に従って、以下のように ~/stack/config.yaml に追記すればいいはずです:


urls:
  latest-snapshot: 
パズルマン
@パズルマン has joined the channel
Masaharu Inomata
@Masaharu Inomata has joined the channel
@ has joined the channel
@ has joined the channel
@ZeAng Cui has joined the channel
@森本涼介 has joined the channel
ライブラリ作成者が、次に出すバージョンのAPIが、前のバージョンのAPIすべてを提供しているか検査する方法はありますか?
意図的な欠落が発生する場合はメジャーバージョンアップしないといけないので、意図しない漏れがないか検査したいのです。
... Replies ...
型レベルリストを扱う上ではヘテロジニアスリストを一般化したような
type BenriList :: (k -> Type) -> [k] -> Type
data BenriList f xs where
  BNil :: BenriList f '[]
  BCons :: f x -> BenriList f xs -> BenriList f (x ': xs)
-- f = Identity だと HList と同型

というデータ型を用意すると便利なことがありますが、これは何と呼ぶのが良いでしょうか?ちなみにvinylだと https://hackage.haskell.org/package/vinyl-0.14.3/docs/Data-Vinyl-Core.html#t:Rec です。
... Replies ...
@Y O has joined the channel