 where
    ligs = filter ((≡) (view _pos key) ∘ view _1) xs
    setLigature (_, i, s) = set (_letters ∘ ix i) (Ligature Nothing s)

klcLayout ∷ (Logger m, Parser m, MonadFail m) ⇒ m KlcParseLayout
klcLayout = many >$> mconcat $
        set' _
setLigatures' ∷ [(Pos, Int, String)] → Key → Key
setLigatures' xs key = foldr setLigature key ligs
  where
    ligs = filter ((≡) (view _pos key) ∘ view _1) xs
    setLigature (_, i, s) = set (_letters ∘ ix i) (Ligature Nothing s)
setLigatures' xs key = foldr setLigature key ligs
  where
    ligs = filter ((≡) (view _pos key) ∘ view _1) xs
    setLigature (_, i, s) = set (_letters ∘ ix i) (Ligature Nothing s)