|
|
|
|
|
by barkmadley
4258 days ago
|
|
You probably could, but there would be lots of extra boiler plate that distract from the central idea. The OCaml language features that are used that would need to be emulated somehow in Java: * Sum types (type a = A of int | B of float). Think tagged unions [1]. * Module functors (module NAME(PARAM : MODULE_TYPE) = struct ... end). Think package level functions (you get some of this with dependency injection frameworks, but it's probably no-where near as safe/sane and flexible. * GADTs (type a = A : int -> int | int term). I'm not sure how you would represent these in java, I'm not fully up to speed on how they work yet. [1]: http://en.wikipedia.org/wiki/Tagged_union |
|