4 ms·
Didn't GHC 8 recently released address this problem?
by hellofunk 10y ago
Didn't GHC 8 recently released address this problem?
- nilved 10y agoYes, but I'm going to guess that that runtime exception is still possible. Record accessors are disambiguated through type inference so if their type is ambiguous it will still fail.
- Morgawr 10y agoI'm intrigued, which one of these problems was fixed? Unfortunately I still have to use 7.8 so it won't help me currently but in the long run it's good to know.
- hellofunk 10y agoUsing the same record field name in different records: https://downloads.haskell.org/~ghc/master/users-guide/8.0.1-notes.html https://downloads.haskell.org/~ghc/master/users-guide/8.0.1-...
- dllthomas 10y agoTechnically the complaint here was of the same record field name in different constructors for the same record, which is perfectly allowed when the fields in question have the same type but not when the types differ. I don't think DuplicateRecordFields addresses this.
- taylorfausak 10y agoThat's correct. {-# LANGUAGE DuplicateRecordFields #-} data A = B { x :: Bool } | C { x :: Int } Example.hs:2:1: error: • Constructors B and C give different types for field ‘x’ • In the data type declaration for ‘A’