Hacker News new | ask | show | jobs
by ufo 3875 days ago
"Functor" might just be the most overloaded term in computer programming... Just of the top of my head it has totally different meanings in Ocaml, Haskell and C++.
1 comments

They're not totally different between OCaml and Haskell. They're based on the same concept from Category Theory: a mapping of objects and morphisms from one category to another. It's just that Haskell functors are at the type level and OCaml's functors are at the module level.

Apparently F# has support for neither style of functor--it doesn't have parametric modules and it also doesn't have typeclasses. So in F# `map` is defined independently for each type:

   Set.map : ('a -> 'b) -> 'a Set -> 'b Set 
   Seq.map : ('a -> 'b) -> 'a seq -> 'b seq 
   List.map : ('a -> 'b) -> 'a list -> 'b list 
   Array.map : ('a -> 'b) -> 'a [] -> 'b []