module - ocaml: create set of polymorphic type -


In a module, I have defined a type that represents a graph node, which has a multicolored data field < / P>

 Type  'at = {data:' a; Adj: 'A T-list}'  

How can I go about creating this data? I according to one of the following recommendations (suggestions.

  Let CMP (G 1: intraday charts) (G 2: ET grafts): Int = if Fijh_ajend G 1 G 2 to 0 Compare Else Int.compare g1.data g2.data Let make_set () = module ORD = straight type t = int Graph.t to = cmp end (module Set.Make (ORD): set type S with Elt = Ord .t)  

But when I do, I get "gets", there is no component with distracted signature "

I'm not sure what you are trying to do, but if you want to create a set of nodes, whose data type is int

  module graph = structure type 'at =} {/ p>    

data:' a; adj: 'in the list) Finally CMP 1: Intai graph) Compare (G-2: intra graph): Int = Ready g1 == G 2 0, and 1 g. Gregkdeta G 2. graph Kdeta module GSet = Set.Make (struct type t = Int graph.t = compare Switch to cmp)

There is a session with the code:

  $ ocaml Okam version 4.01.0 # using "live. ML ";; Module Graph: Sig Type 'A T = {Data:' A; Adj: 'A T List;} and Val CMP: Int Graph - - & gt; Int Graph.t - & gt; Int = & lt ; fun & gt; module GSet: sig type elt = int Graph.t.. end # allow myset = GSet.add {Graph.data = 14; Adj = []} Jisiti.ampi ;; Val myset: GSet.t = & lt; abstr & gt; # Jisattikaisaimtiai Maisset ;; -   

I have no reason to disrupt the module type, the Set.S already Set.Make . But I have a sophisticated type of Okamel module User do not.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -