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/sounds/sounds.ml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/lib/sounds/sounds.ml') diff --git a/src/lib/sounds/sounds.ml b/src/lib/sounds/sounds.ml index 92a644f..e5f5d29 100644 --- a/src/lib/sounds/sounds.ml +++ b/src/lib/sounds/sounds.ml @@ -1,4 +1,5 @@ module Sig = Sig +module Repr = Repr type kind = | None @@ -239,14 +240,15 @@ let muted f = code = Muted f } let rec repr - : t -> Repr.t - = fun letter -> + : type a. (module Sig.REPR with type t = a) -> t -> a + = fun m letter -> + let module Repr = (val m:Sig.REPR with type t = a) in match letter.code, letter.nasal with - | None, _ -> "" + | None, _ -> Repr.none | Voyel_A, false -> Repr.a | Voyel_A, true -> Repr.a_nasal - | Voyel_AI, false -> "E" + | Voyel_AI, false -> Repr.e_opened | Voyel_AI, true -> Repr.i_nasal | E_Closed, _ -> Repr.e_closed | E_Opened, true | Voyel_E, true -> Repr.a_nasal @@ -283,5 +285,5 @@ let rec repr | Consonant_N, _ -> Repr.n | Consonant_L, _ -> Repr.l | Consonant_R, _ -> Repr.r - | Diphtonge (l1, l2), _ -> Repr.diphtongue (repr l1) (repr l2) - | Muted t, _ -> Repr.muted (repr t) + | Diphtonge (l1, l2), _ -> Repr.diphtongue (repr m l1) (repr m l2) + | Muted t, _ -> Repr.muted (repr m t) -- cgit v1.2.3