{-# OPTIONS -fno-warn-orphans #-}
module Debian.Version.Text
    ( ParseDebianVersion(..)
    ) where

import Text.ParserCombinators.Parsec

import qualified Data.Text as T

import Debian.Version.Common
import Debian.Version.Internal

instance ParseDebianVersion T.Text where
    parseDebianVersion :: Text -> Either ParseError DebianVersion
parseDebianVersion Text
text =
        let str :: [Char]
str = Text -> [Char]
T.unpack Text
text in
        case forall s t a.
Stream s Identity t =>
Parsec s () a -> [Char] -> s -> Either ParseError a
parse CharParser () (Found Int, NonNumeric, Found NonNumeric)
parseDV [Char]
str [Char]
str of
          Left ParseError
e -> forall a b. a -> Either a b
Left ParseError
e
          Right (Found Int, NonNumeric, Found NonNumeric)
dv -> forall a b. b -> Either a b
Right ([Char]
-> (Found Int, NonNumeric, Found NonNumeric) -> DebianVersion
DebianVersion [Char]
str (Found Int, NonNumeric, Found NonNumeric)
dv)