Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Haskell features in O'Caml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sven <luther@d...>
Subject: Re: [Caml-list] Haskell features in O'Caml
On Sat, 22 Sep 2001 13:50:11 +0200, Steven Murdoch <steven@murdomedia.net> wrote:
> The main one I would like is the type assertion facility of Haskell.
> For example, one might write:
> mul :: Int -> Int -> Int
> mul a b = a * b
>
On Sun, 23 Sep 2001 18:08:36 +0200, Florian Hars <florian@hars.de> wrote:
> # module M : sig
>     val mul : int -> int -> int
>   end = struct
>     let mul a b = a * b
>   end;;
> module M : sig val mul : int -> int -> int end
>
On Sun, 23 Sep 2001 18:21:07 +0200, "Mattias Waldau" <mattias.waldau@abc.se> wrote: 
> # let mul (a:int) (b:int) : int = a*b;;
> val mul : int -> int -> int = <fun>
>
On Sun, Sep 23, 2001 at 01:50:21PM -0400, Dave Mason wrote:
> 
> # let (mul : int -> int -> int) = fun x y -> x*y;;
> val mul : int -> int -> int = <fun>
> 

But you have to recognize that non of these solution is as elegant as the
haskel way of doing it, isn't ti ?

maybe this would be nice :

val mul : int -> int -> int
let mul x y = ...

Sure, i know the right way is to put the declaration of mul in a separate
file, but still, it would be nice to be able to do it in one file only.

Friendly,

Sven Luthert
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr