module Bio.Utils.Monomer ( Symbol(..) , FromSymbol(..) , ThreeSymbols(..) , FromThreeSymbols (..) ) where import Data.Text ( Text ) class Symbol a where symbol :: a -> Char instance Symbol Char where symbol :: Char -> Char symbol = forall a. a -> a id class FromSymbol a where fromSymbol :: Char -> Maybe a fromSymbol = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c either (forall a b. a -> b -> a const forall a. Maybe a Nothing) forall a. a -> Maybe a Just forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a. FromSymbol a => Char -> Either Char a fromSymbolE fromSymbolE :: Char -> Either Char a fromSymbolE Char c = forall b a. b -> (a -> b) -> Maybe a -> b maybe (forall a b. a -> Either a b Left Char c) forall a b. b -> Either a b Right forall a b. (a -> b) -> a -> b $ forall a. FromSymbol a => Char -> Maybe a fromSymbol Char c instance FromSymbol Char where fromSymbolE :: Char -> Either Char Char fromSymbolE = forall a b. b -> Either a b Right class ThreeSymbols a where threeSymbols :: a -> Text class FromThreeSymbols a where fromThreeSymbols :: Text -> Maybe a