I've written substantial programs in both SML and OCaml, and in neither one did I use the module system in a way that wouldn't work in the Haskell module system.
Because thinking about a module as a type is weird. By contrast, Rust: fn reduce<A, F>(&[A], F) -> A where F: Monoid<T = A> Or even better, the actual signature, which says what it *is*: fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B
-
-
I think this is more due to your familiarity than the actual readability of the code -- the code in OCaml gives a lot more semantic clarity, imo, and passing modules as values is not especially weird (it's common in C++ or Haskell, the latter through typeclasses)
-
I don’t expect to convince you.
End of conversation
New conversation -
-
-
A module having a type and being able to refer to that type is straight up based on type theory. See https://youtu.be/oJOYVDwSE3Q?t=30m6s … (a few minutes of the video) in which
@chrisamaphone explains this really neatly.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.