
On Sat, Jan 09, 2016 at 07:48:04PM +0100, Arjen wrote:
I'm not quite sure what you're asking, but consider the difference between these two calls to the function id in OCaml.
# let id x = x;; val id : 'a -> 'a = <fun>
# id (Printf.printf "Hello");; Hello- : unit = ()
# id (fun () -> Printf.printf "Hello");; - : unit -> unit = <fun>
The correspond to the following in an imaginary impure Haskell-like language:
id (print "Hello") "Hello"
id (\() -> print "Hello") <no output>
I think I see what you mean. Then in OCaml exps would have type unit->Int? And to get the value, you would use exps ()?
In OCaml exps could have type A, where A is isomorphic to () -> (Double, A) To get the first value you could (effectively) use 'exps ()'. You get a tail of type A along with it. I suggest you look through Oleg's code. It's quite illuminating. http://okmij.org/ftp/ML/powser.ml Tom