Posts

Showing posts from January 5, 2008

Haskell and F#: Language Design

Image
After watching a taste of Haskell by Simon Peyton-Jones and having a look at A History of Haskell: being lazy with class , I am left with some open questions regarding the design of F#: Why is F# not lazy?: What is the advantage of eagerness? Is there a point in encapsulating side-effectful operations in monads while programming in F#? IO Monads etc.? #light // Sample F# IO Monad : OSCON Haskell Video Part 2 type IO<'a> = IO of 'a // get: unit -> IO<string> let get () = IO(read_line ()) // put: string -> IO<unit> let put x = IO(print_string x) // bind.e: IO<'a> -> 'a // bind: IO<'a> -> ('a -> IO<'b>) -> IO<'b> let bind (x:IO<'a>) (y:('a -> IO<'b>)) = let e (IO(a)) = a in y (e x) let (>>=) = bind // gp: unit -> IO<unit> let gp () = get () >>= put gp () Why did the F# team chose ML and OCaml over Haskell? I hope someone from the F# team