tweag / monad-bayes

A library for probabilistic programming in Haskell.
MIT License
410 stars 62 forks source link

T in the transformer names #189

Closed reubenharry closed 1 year ago

reubenharry commented 2 years ago

Sequential -> SequentialT Traced -> TracedT Population -> PopulationT run[X] -> run[X]T

This helps Haskellers understand what is going on better.

### Tasks
- [ ] Sequential
- [ ] Traced
- [ ] Population
- [ ] Weighted
- [ ] Density
- [ ] Sampler
- [ ] run* functions
aleeusgr commented 2 years ago

I'd love to help, but this does not make sense to me.

If you'd shared a doc on what is "transformer", how to find them in the code, I'd think of this as a task I could do.

Thanks.

reubenharry commented 2 years ago

Hi. Sure, I can clarify!

How familiar are you with Haskell? If not, it's actually ok for this one, because basically what I'm suggesting is just a renaming, as follows:

Everywhere "Sequential" appears in the code, we replace it with "SequentialT". So the type Sequential becomes SequentialT, the constructor Sequential also becomes SequentialT and runSequential becomes runSequentialT.

Similarly for Population and Traced.

I think search and replace would mostly work for this.

aleeusgr commented 2 years ago

I'm ok with Haskell, not a brightest of minds but I'm learning:) there's only four of them? Ok, search and replace, on it.

grep -rnw -e 'Sequential' --include \*.hs

aleeusgr commented 2 years ago

find . -type f -exec sed -i 's/Sequential/SequentialT/g' {} \;

https://stackoverflow.com/questions/15402770/how-to-search-and-replace-using-grep

Hm, It breaks git repo...

find ./*.hs -type f -exec sed -i 's/Sequential/SequentialT/g' {} \; ??

aleeusgr commented 2 years ago

find . -name "*.hs" -type f -exec sed -i 's/<oldname>/<newname>/g' {} \;

also not to forget to rename .hs files and tests; update monad-bayes.cabal

aleeusgr commented 2 years ago

@reubenharry created a PR