Lysxia / first-class-families

First-class type families
https://hackage.haskell.org/package/first-class-families
MIT License
86 stars 12 forks source link

Tree functions? (fold, unfold, flatten, levels etc) #17

Closed gspia closed 4 years ago

gspia commented 4 years ago

Hi again!

How would you find Tree -functions? The one listed in the title can be used to implement Hylo for trees, which in turn, can be used to calculate e.g. fibonacci numbers on type level nats.

If you want to take a look, there is a gist at

This would mean that fcf would get a dependency on containers. While containers is widely used, I really had a bit hard time when thinking if I would suggest these functions. Namely, I like a lot of libs that don't have too many dependencies :)

Lysxia commented 4 years ago

I would like the scope of the library to remain small. So I think a module for trees would belong better in another library ("fcf-tree"?). I'd be happy to help in any way if you want to make that package.

It's probably not worth depending on containers, as opposed to just redefining the type, which is the only thing that can be reused.

The only good reason I could think for that would be if you also wanted to reflect (first-class) type families into regular term-level functions, which is a pretty big part of the singletons library, and seems like a lot of work to replicate for fcfs.

gspia commented 4 years ago

Ok & thanks & true, I'll guess it is good enough to just redefine the type. My motivation for these is to see, how one can make type-level computations and what kind of general purpose machinery there could be to help to do those computations.

I'll try that redefinition and think about making a new lib & will close this issue now.