Instantly share code, notes, and snippets.

Embed
What would you like to do?
open Core
open Set
module type AUTOM' = sig
module AlphSet: Set.S
module StateSet: Set.S
type t = {
alph: AlphSet.t;
states: StateSet.t;
trans: StateSet.Elt.t -> AlphSet.Elt.t -> StateSet.Elt.t;
init: StateSet.Elt.t;
final: StateSet.t}
end
module type AUTOM =
functor (AlphSet: Set.S) (StateSet: Set.S) ->
AUTOM'
with module AlphSet = AlphSet
with module StateSet = StateSet
module Autom = functor (AlphSet: Set.S) (StateSet: Set.S) -> struct
module AlphSet = AlphSet
module StateSet = StateSet
type t = {
alph: AlphSet.t;
states: StateSet.t;
trans: StateSet.Elt.t -> AlphSet.Elt.t -> StateSet.Elt.t;
init: StateSet.Elt.t;
final: StateSet.t}
end
type alph = Zero | One [@@deriving sexp, compare]
module Alph = struct
type t = alph
let compare = compare_alph
let t_of_sexp = alph_of_sexp
let sexp_of_t = sexp_of_alph
end
module AlphSet = Set.Make(Alph)
module StringSet = Set.Make(String)
module ZeroOneAutom = Autom(AlphSet)(StringSet)
open Core
open Set
module type AUTOM' = sig
module AlphSet: Set.S
module StateSet: Set.S
type t = {
alph: AlphSet.t;
states: StateSet.t;
trans: StateSet.Elt.t -> AlphSet.Elt.t -> StateSet.Elt.t;
init: StateSet.Elt.t;
final: StateSet.t}
end
module type AUTOM =
functor (AlphSet: Set.S) (StateSet: Set.S) ->
AUTOM'
with module AlphSet = AlphSet
with module StateSet = StateSet
module Autom: AUTOM
type alph = Zero | One [@@deriving sexp, compare]
module Alph: Set.Elt
module AlphSet: Set.S with type Elt.t = alph
module StringSet: Set.S with type Elt.t = string
module ZeroOneAutom: AUTOM'
with module AlphSet = AlphSet
with module StateSet = StringSet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment