From 3b8c136ebdba7f4b5b4d6baad08d0a75c3b2dc86 Mon Sep 17 00:00:00 2001
From: Sébastien Dailly <sebastien@chimrod.com>
Date: Sat, 28 Aug 2021 20:01:54 +0200
Subject: Update

---
 src/lib/modifiers/nasal.ml    | 24 ++++++++++++++++++------
 src/lib/modifiers/sig.ml      |  4 ++--
 src/lib/modifiers/vocalize.ml |  5 ++---
 3 files changed, 22 insertions(+), 11 deletions(-)

(limited to 'src/lib/modifiers')

diff --git a/src/lib/modifiers/nasal.ml b/src/lib/modifiers/nasal.ml
index b9874c9..fbaa35d 100644
--- a/src/lib/modifiers/nasal.ml
+++ b/src/lib/modifiers/nasal.ml
@@ -1,3 +1,17 @@
+let transform
+  : (module Sounds.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.T with type t = el) in
+    let (((v1, v2), _) , _) = init in
+
+    begin match T.nasal v1, T.nasal v2 with
+      | Some t1, Some t2 ->
+        ( ( (t1, t2)
+          , c )
+        , None )
+      | _ -> init
+    end
+
 (** The Nasal modifier transform a voyel followed by N and a consonant
     into a nasal voyel.
 
@@ -13,11 +27,9 @@ let process
     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 ->
-      (* Remove the ending consonant, and transform the voyel into
-         the nasal form  *)
-      ( ( (T.nasal v1, T.nasal v2)
-        , c )
-      , None )
+      transform m c init
+    (* Remove the ending consonant, and transform the voyel into
+       the nasal form  *)
     | 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 *)
@@ -27,7 +39,7 @@ let process
                Sig.opening = tl
              ; Sig.ending = (Some (Some opening))
              }) c in
-      ( ( (T.nasal v1, T.nasal v2)
+      ( ( (v1, v2)
         , c )
       , None )
     | _ ->
diff --git a/src/lib/modifiers/sig.ml b/src/lib/modifiers/sig.ml
index 938c50e..1485247 100644
--- a/src/lib/modifiers/sig.ml
+++ b/src/lib/modifiers/sig.ml
@@ -7,6 +7,6 @@ type 'a consonants =
 
 type 'a group = 'a voyel * 'a consonants option
 
-type 'a modifier = (module Sounds.T with type t = 'a) -> ('a group * 'a option option)  -> ('a group * 'a option option)
-
+type 'a t = 'a group * 'a option option
 
+type 'a modifier = (module Sounds.T with type t = 'a) -> 'a t  -> 'a t
diff --git a/src/lib/modifiers/vocalize.ml b/src/lib/modifiers/vocalize.ml
index 86a0502..6857718 100644
--- a/src/lib/modifiers/vocalize.ml
+++ b/src/lib/modifiers/vocalize.ml
@@ -13,8 +13,7 @@ let process
          not trnasform the S into Z *)
       let is_voyel = T.is_voyel v1 && T.is_voyel v2 in
       match is_voyel, op.Sig.opening, op.Sig.ending with
-      | true, hd::[], None when T.code hd = T.SZ ->
-        let c = Some { op with opening = [T.z ()] } in
+      | true, hd::[], None when hd = T.sz ->
+        let c = Some { op with opening = [T.z] } in
         (((v1, v2), c) , ending)
       | _ -> init
-
-- 
cgit v1.2.3