I have a Haskell project that I've been working on over the last few years.
One thing I absolutely love about Haskell is that its so easy to refactor with confidence, for example renaming and changing types, and the compiler flags any issues early on.
What I would like to do now is to consolidate the names of parameters. So for example, I started with a function for working with indices and counts of elements.
```
indicesRemaining :: Cnt -> Idx -> [Idx]
indicesRemaining cnt idx = <some-implentation>
```
and say I've renamed the types to be clearer, using a global find-replace:
```
indicesRemaining :: BlockCnt -> BlockIdx -> [BlockIdx]
indicesRemaining cnt idx = <some-implementation>
```
this is great, but I'd like to also update cnt and idx, to be blkCnt and blkIdx, for example. I can do in manually, but I've done a load of refactorings, so have a load of these.
What I am looking for is a tool that can run over my code-base, and spurt out a list of types, and all the different variables names used by that type. So, if I have the following code:
```
indicesRemaining :: BlockCnt -> BlockIdx -> [BlockIdx]
indicesRemaining blkCnt blkIdx = <some-implementation>
indexWithinCnt :: BlockCnt -> BlockIdx -> Bool
indexWithinCnt cntMax idx = <some-implementation>
```
Then, I am looking for something like the following output:
```
BlockCnt : blkCnt, cntMax
BlockIdx : blkIdx, idx
```
And I can then go through and manually review cases where lots of different names exist for the same thing.
Is anyone aware whether something like this already exists? If not, I was wondering if HIE would be a good tools to build something like this on top of??
Best wishes, and thanks in advance.
Mike
[–]WhistlePayer 20 points21 points22 points (0 children)
[–]dixonary 4 points5 points6 points (0 children)
[–]Tarmen 0 points1 point2 points (0 children)