{-# OPTIONS_HADDOCK show-extensions #-}
-- |
-- Module : Phonetic.Languages.Basis
-- Copyright : (c) OleksandrZhabenko 2020-2022
-- License : MIT
-- Stability : Experimental
-- Maintainer : olexandr543@yahoo.com
--
-- Simplified version of the @phonetic-languages-common@ and @phonetic-languages-general@ packages.
-- Uses less dependencies.
{-# LANGUAGE BangPatterns, FlexibleContexts #-}
module Phonetic.Languages.Basis where
data Result t a b c = R {line :: !(t a), propertiesF :: !b, transPropertiesF :: !c} deriving Eq
instance (Ord (t a), Ord b, Ord c) => Ord (Result t a b c) where
compare x y
= case compare (transPropertiesF x) (transPropertiesF y) of
!EQ -> case compare (propertiesF x) (propertiesF y) of
!EQ -> compare (line x) (line y)
!z -> z
!z0 -> z0
{-# INLINE compare #-}
data FuncRep2 a b c = D { getAB :: (a -> b), getBC :: (b -> c) }
getAC :: FuncRep2 a b c -> (a -> c)
getAC (D f g) = g . f
{-# INLINE getAC #-}