エラーが発生したときに、実在するレコードのレコード更新を使用しようとしていました。速いgoogleは私にfeature request #2595に導かれました。これはバージョン6.8.3のGHC用に実装されていることを示しています。私は6.10.4を使用していますので、私はそれが動作するはずだと思うだろうが、機能要求からのコード例:機能要求に訴えてHaskell:既存タイプのレコード更新
{-# LANGUAGE ExistentialQuantification,Rank2Types #-}
module Foo where
data Foo = forall a . Foo { foo :: a -> a, bar :: Int }
x :: Foo
x = Foo { foo = id, bar = 3 }
f :: Foo -> Foo
f rec = rec { foo = id }
g :: Foo -> Foo
g rec = rec { bar = 3 }
は同じエラーを得:
test.hs:10:8:
Record update for the non-Haskell-98 data type `Foo' is not (yet) supported
Use pattern-matching instead
In the expression: rec {foo = id}
In the definition of `f': f rec = rec {foo = id}
test.hs:13:8:
Record update for the non-Haskell-98 data type `Foo' is not (yet) supported
Use pattern-matching instead
In the expression: rec {bar = 3}
In the definition of `g': g rec = rec {bar = 3}
これは意識的に削除された機能ですか、またはバグレポートを提出する必要がありますか?
Ah。私のバージョンで修正する必要があると仮定して、私に愚かな間違いをさせないようにしてくれてありがとう。 GHCを更新するにはオフに! – rampion
あなたが言ったのと全く違った新しいエラーメッセージ。しかし、私は何かが間違っていると思っている、それは不可能ではありません。 – rampion