I have this configuration that works but my attempt to use an external file use "external.file"; in the functor failed. I wanted to test an external file by calling the functions in the functor since I didn't want to touch the external file. It doesn't export any modules.
When I listed the file after is it reported an error as no modules were exported. Believe this file should be included in the configuration somewhere else. How can I do that ?
build.cm
source (-) (* export all defined modules *)
structure Test(* OR, export selectively *)
signature THEOREM
functor Theorem
is
(* Import the SML standard library, aka Basis. *)
(* See: http://sml-family.org/Basis/ *)
$/basis.cm
(* Import the SML/NJ library *)
(* Provides extra data structures and algorithms. *)
(* See: https://www.smlnj.org/doc/smlnj-lib/Manual/toc.html *)
$/smlnj-lib.cm
(* List each source file you want to be considered for compilation. *)
./test.sml
./theorem.sig
./theorem.fun
theorem.fun
structure Test =
struct
structure T = Theorem()
fun main () =
T.update
end
theorem.sig
signature THEOREM =
sig
val message : string
val update : (int * string) list option
end
theorem.fun
The update' function is supposed to be in the external file. I copied it here because I couldn't use that file.
functor Theorem() : THEOREM=
struct
fun update' front [] (l,n) = NONE
| update' front ((l',n')::pairs) (l,n) =
if l=l' then
SOME(front @ ((l,n)::pairs) )
else
update' ((l',n')::front) pairs (l,n)
val update = update' [] [(1, "one")] (1,"one")
end