From 123c8bc693063cfc880709c7dfa700a177a66adb Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 3 Sep 2021 17:37:03 +0200 Subject: Ended refactoring --- src/lib/modifiers/mute.ml | 4 ++-- src/lib/modifiers/nasal.ml | 11 +++++------ src/lib/modifiers/sig.ml | 2 +- src/lib/modifiers/vocalize.ml | 5 +++-- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/lib/modifiers') diff --git a/src/lib/modifiers/mute.ml b/src/lib/modifiers/mute.ml index 3597876..331ed1a 100644 --- a/src/lib/modifiers/mute.ml +++ b/src/lib/modifiers/mute.ml @@ -1,12 +1,12 @@ open StdLabels +module T = Sounds (** Mute the last consonant if there is no voyel in the syllabus. This modifier is only applied in the first step, and not repeated anymore. *)let process : 'a Sig.modifier - = fun (type el) m init -> - let module T = (val m:Sounds.Sig.T with type t = el) in + = fun init -> let (((v1, v2), c) , ending) = init in let is_voyel = T.is_voyel v1 && T.is_voyel v2 in match is_voyel, c with diff --git a/src/lib/modifiers/nasal.ml b/src/lib/modifiers/nasal.ml index ec8ddb4..57a3235 100644 --- a/src/lib/modifiers/nasal.ml +++ b/src/lib/modifiers/nasal.ml @@ -1,9 +1,9 @@ +module T = Sounds (* Remove the ending consonant, and transform the voyel into the nasal form *) let transform - : (module Sounds.Sig.T with type t = 'a) -> 'a Sig.consonants option -> 'a Sig.t -> 'a Sig.t - = fun (type el) m c init -> - let module T = (val m:Sounds.Sig.T with type t = el) in + : Sounds.t Sig.consonants option -> Sounds.t Sig.t -> Sounds.t Sig.t + = fun c init -> let (((v1, v2), _) , _) = init in begin match T.nasal v1, T.nasal v2 with @@ -21,15 +21,14 @@ let transform merge from two distinct elements ? *) let process : 'a Sig.modifier - = fun (type el) m init -> - let module T = (val m:Sounds.Sig.T with type t = el) in + = fun init -> let (((v1, v2), c) , ending) = init in let ending = Option.bind ending (fun x -> x) in let opening = Option.map (fun v -> v.Sig.opening) c in let is_voyel = T.is_voyel v1 && T.is_voyel v2 in match ending, is_voyel, opening with | Some ending, _, _ when T.is_nasal ending -> - transform m c init + transform c init | None, false, Some (opening::tl) when T.is_nasal opening -> (* If there is no voyel here, transform the opening consonant as an ending consonant for the next syllabus *) diff --git a/src/lib/modifiers/sig.ml b/src/lib/modifiers/sig.ml index 4cf605f..bcc4af2 100644 --- a/src/lib/modifiers/sig.ml +++ b/src/lib/modifiers/sig.ml @@ -9,4 +9,4 @@ type 'a group = 'a voyel * 'a consonants option type 'a t = 'a group * 'a option option -type 'a modifier = (module Sounds.Sig.T with type t = 'a) -> 'a t -> 'a t +type 'a modifier = 'a t -> 'a t diff --git a/src/lib/modifiers/vocalize.ml b/src/lib/modifiers/vocalize.ml index b390757..1014642 100644 --- a/src/lib/modifiers/vocalize.ml +++ b/src/lib/modifiers/vocalize.ml @@ -1,9 +1,10 @@ +module T = Sounds + (** Transform the S into Z if the S is the opening consonant and there is no ending consonant before *) let process : 'a Sig.modifier - = fun (type el) m init -> - let module T = (val m:Sounds.Sig.T with type t = el) in + = fun init -> let (((v1, v2), c) , ending) = init in match c with -- cgit v1.2.3