|
|
|
|
|
by profquail
4457 days ago
|
|
Yes, F# is missing parameterized modules ("functors"); these are simply modules which are parameterized by other modules in the same way .NET generics (for example) allow you to parameterize one type by another type. The reason this would be nice to have in F# is that, while the CLR's generics are excellent in general, there are some things that can't be expressed using the CLR's type constraints. Supporting functors in F# would provide a nice way to work around this and allow you to write code which is more generic. Here's my proof-of-concept code. I'll warn you now though -- it looks quite messy, because the goal was to show that functors could be supported on top of the existing .NET type system. If functors are ever added to the F# language, the syntax will be much, much cleaner. https://github.com/jack-pappas/experimental-functors |
|