mstksg / backprop

Heterogeneous automatic differentiation ("backpropagation") in Haskell
https://backprop.jle.im
BSD 3-Clause "New" or "Revised" License
180 stars 22 forks source link

Add Ø alias 'nil' #1

Closed stites closed 7 years ago

stites commented 7 years ago

I came across this blip when working through MNIST and your docs. While only does exist, you can't pattern match on it. As I'm working through the repo I find it nice to be able to type out my Ø. This is purely cosmetic, so I'd understand if this is an unwanted PR.

mstksg commented 7 years ago

I considered adding this initially, but I was a bit hesitant of exporting utility functions for type-combinators (which is why I hid them in a hidden module when I did find any useful). Small things like this would be useful. In this particular case, it might help to make it a pattern synonym, even, so you can pattern match on Nil.

Still, I don't think this project is the right place for this. It's useful for interactive usage, maybe, and the user can define their own for now. but i think the right place for this would probably be in type-combinators, not here. I've had problems submitting PR's because the repo doesn't build, but I'm hoping one day that the repo will be PR-able.

If the time comes for me to "release" this package and pull it out of alpha, and nil isn't in type-combinators yet, I'll probably add it, then, for completeness :) Until then I think introducing a new entity to the API that would be a breaking change if i decided to remove it in favor of a type-combinators one might be premature.

stites commented 7 years ago

That's completely sane. I should have realized that this is really coming from type-combinators! Closing this PR now.