Comments (4)
In the first case the information at 6:14 should be:
PFieldWildcard
(Scoped (RecPatWildcard [
Selector (ModuleName () "RecordSelector") (Ident () "field") (Ident () "Record") [Ident () "Record"]])
(SrcSpanInfo{srcInfoSpan = SrcSpan "RecordSelector.hs" 6 14 6 16,
srcInfoPoints = []}))
This should allow you to figure out that the local value "field"
came from a record pattern wildcard.
Alternatively we could add more information to the LocalValue
constructor.
In the second case the left-hand-side of the record field pattern should be resolved to a global symbol that refers to the record selector.
from haskell-names.
This should allow you to figure out that the local value "field" came from a record pattern wildcard.
Fair enough. I guess I was hoping to not have to keep track of any kind of environment for this renaming (which would allow me to do the renaming using a simple generic traversal instead of manually going through the AST), but maybe that is expecting too much.
In the second case the left-hand-side of the record field pattern should be resolved to a global symbol that refers to the record selector.
Right – so that is a bug, isn’t it?
from haskell-names.
Right – so that is a bug, isn’t it?
Yes, should be fixed by #89 which also fixes the other bug you encountered.
I am thinking about adding a field to LocalValue
but it feels a little ad-hoc.
In the meantime I can offer you two workarounds:
- Rename local values too.
data RecordSelector_Record a = RecordSelector_Record { RecordSelector_field :: a }
RecordSelector_unRecord RecordSelector_r = RecordSelector_field
where RecordSelector_Record { .. } = RecordSelector_r
- Desugar record wildcards and puns.
data RecordSelector_Record a = RecordSelector_Record { RecordSelector_field :: a }
RecordSelector_unRecord r = field
where RecordSelector_Record { RecordSelector_field = field } = r
P.S.: Last time I tried to merge Haskell programs into one big module I got stuck because the TypeFamilies
extension broke code from another module.
from haskell-names.
- Rename local values too.
Well, to do so in my case I need to know what module the Record
is defined in, so that the names of the renamed local values match that.
- Desugar record wildcards and puns.
That might be the way to go. I did that by hand for now.
P.S.: Last time I tried to merge Haskell programs into one big module I got stuck because the TypeFamilies extension broke code from another module.
Luckily the itch I was scratching does not use TypeFamilies
.
from haskell-names.
Related Issues (20)
- In tests/annotations/FnBind.hs, shouldn't f be global? HOT 1
- Add haskell-names back to stackage HOT 4
- test failure, missing extra-source-file HOT 2
- Return computed tables with annotate HOT 2
- Rename `Symbol` to `Entity`.
- Overlapping instances for GTraversable HOT 1
- Document `resolve` behaviour better HOT 2
- Allow to pass -XNoImplicitPrelude to 'importTable' explicitly
- Support QuasiQuotes scoping
- Support recent versions of aeson and traverse-with-class
- Doesn't resolve TemplateHaskell splices and top-level usages
- Please, release 0.9.0 version HOT 2
- Resolving local function's type signatures
- Bump-up to 'haskell-src-exts-1.20.1' (also support build with stack) HOT 2
- Is there a tool to update the data/baseEnvironment files? HOT 3
- haskell-src-exts dependency HOT 4
- Tests fail (new aeson?) probably due to json field ordering
- GADT constructors not Value Binders
- Promoted names annotated in wrong context
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haskell-names.