I also have almost 0 interest in OCaml due to the syntactic choices they've made.
I also have almost 0 interest in OCaml due to the syntactic choices they've made.
Compare functor's definitions in either syntax:
module type FUNCTOR = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
end;;
class Functor where
fmap :: (a -> b) -> f a -> f b
The latter looks cleaner to me. There are other ways you could write it (for example if you turned on explicit forall it would get messier.At this point I start skipping talks at conferences when they're in Scala because the amount of noise in the syntax is near unbearable to me (and there's likely to be a haskell talk on a similar topic) -- OCaml is much better in that respect, but I still find Haskell's syntax to be easiest on the eyes. OCaml might be more pedantically descriptive though, it seems to be more explicit about everything.
I would rather say explicit, and that was a breath of fresh air to me after Haskell. As for your example, how many instances do you need to write all the type classes you need?
In OCaml I could just write all the functions I need in a file, and this file-module would implement all the signatures, thanks to the structural typing, now condiser:
type 'a t
val bind : 'a t -> ('a -> 'b t) -> 'b t
val apply : ('a -> 'b) t -> 'a t -> 'b t
val map : ('a -> 'b) -> 'a t -> 'b t
val show : 'a t -> ('a -> string) -> string
val return : 'a -> 'a t
instead of instance Functor a => Functor (Type a) where
fmap :: (a -> b) -> f a -> f b
instance Applicative a => Applicative (Type a) where
<*> :: f (a -> b) -> f a -> f b
instance Show (Type a) where
show :: a -> string
instance Monad...
which is more verbose?