(Very minor) code clean-up.

This commit is contained in:
Philippe Pittoli 2024-01-20 01:05:11 +01:00
parent 7b5e92490d
commit 634aad96b7
3 changed files with 5 additions and 6 deletions

View File

@ -13,12 +13,12 @@ import Data.String as S
import Data.String.CodeUnits as CU import Data.String.CodeUnits as CU
-- Import all common functions between RFC1035 and modern domain parsing. -- Import all common functions between RFC1035 and modern domain parsing.
import GenericParser.DomainParser.Common (DomainError(..), eof, ldh_str, let_dig, let_dig_hyp, max_domain_length, max_label_length, Size) import GenericParser.DomainParser.Common (DomainError(..), eof, ldh_str, let_dig, max_domain_length, max_label_length)
import GenericParser.Parser (Parser(..) import GenericParser.Parser (Parser(..)
, success, failureError , failureError
, current_position , current_position
, alphanum, char, letter, many1, parse, string , char, letter, parse, string
, try, tryMaybe) , try, tryMaybe)
-- | From RFC 1035: <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ] -- | From RFC 1035: <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]

View File

@ -121,8 +121,7 @@ try p = Parser p'
_ -> failureError position error _ -> failureError position error
sat :: forall e. (Char -> Boolean) -> Parser e Char sat :: forall e. (Char -> Boolean) -> Parser e Char
sat p = do sat p = do pos <- current_position
pos <- current_position
x <- item x <- item
if p x then pure x else Parser \input -> failure pos if p x then pure x else Parser \input -> failure pos

View File

@ -5,7 +5,7 @@ import GenericParser.DomainParser.Common (ldh_str, DomainError(..))
import GenericParser.DomainParserRFC1035 as RFC1035 import GenericParser.DomainParserRFC1035 as RFC1035
import GenericParser.DomainParser as ModernDomains import GenericParser.DomainParser as ModernDomains
import Prelude (Unit, discard, show, ($), (<>), map) import Prelude (Unit, discard, show, ($), (<>))
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.String.CodeUnits (fromCharArray) import Data.String.CodeUnits (fromCharArray)