Skip to content

Instantly share code, notes, and snippets.

@ashiato45
Created July 30, 2018 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashiato45/72337fb363027e965bfc15bd9413dfe0 to your computer and use it in GitHub Desktop.
Save ashiato45/72337fb363027e965bfc15bd9413dfe0 to your computer and use it in GitHub Desktop.
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