[Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.

Richard A. O'Keefe ok at cs.otago.ac.nz
Thu Apr 4 01:24:53 CEST 2013


On 4/04/2013, at 5:59 AM, Tillmann Rendel wrote:
> As I understand it, in ML, it seemed to be a clever idea to not have type signatures at all.

Wrong.  In ML, it seemed to be a clever idea not to *NEED* type signatures,
and for local definitions they are very commonly omitted.
But you can certainly HAVE type signatures, and for modules
('structures') it is normal to have them in the interfaces ('signatures').

signature SOME_SIG =
   sig
      val f : int -> int list -> int
      val a : int
   end

structure Some_Struct : SOME_SIG =
   struct
      fun f i []     = i
        | f i (x:xs) = f (i+x) xs

      val a = 42
   end

What ML does not have is type *quantifiers*.

For that matter, you could say that ML has one type class: Eq.




More information about the Haskell-Cafe mailing list