The reason is simply that F# has limited support for module signatures (like STRING) and no support for functors (like Make). Specifically, module signatures may only appear in .fsi files.

So you will have to work to translate your OCaml code into F#. That entails replacing the module signature with a .NET interface and replacing the functor with a class with a constructor Make that accepts objects adhering to your new STRING interface. This is the idiomatic OOP equivalent but, of course, it cannot be statically checked to the same degree. However, IMO, the errors caught by this aspect of OCaml's static checking were unimportant anyway.

For inspiration, look no further than F#'s own Set and Map implementations which use exactly this approach to fake conventional module signatures and functors from OCaml's stdlib.

Cheers,
Jon Harrop.

By on 7/26/2008 1:18 PM ()

Thanks, your post helps.

Do you know if there are any places to check for compatibility issues and solutions between OCaml and F#? I have only seen this

[link:research.microsoft.com]

Anyway, I hope I can get one your book on F# soon. Please include samples on string processing, like Boyer-Moore, Knuth-Morris-Pratt and the like.

Thanks again.

By on 7/27/2008 11:22 AM ()

Hello,

I did not yet look at the implementation of the searching algorithm;
but how about something like this:

1
2
3
4
5
6
7
8
9
type ('a, 'b)  str = class
 abstract length : 'a -> int
 abstract get : 'a -> int -> 'b 
end 

type ('a, 'b, 'c) map = class
  val p: ('a, 'c) str
  val t: ('b, 'c) str
end

If this does not help you, I will try to look at the code closer again.

With best regards,
Keiko

By on 7/28/2008 1:44 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper