diff --git a/src/Internal/Grammar/ServerName.elm b/src/Internal/Grammar/ServerName.elm index 1ee3cff..b61e913 100644 --- a/src/Internal/Grammar/ServerName.elm +++ b/src/Internal/Grammar/ServerName.elm @@ -47,8 +47,8 @@ type alias IPv6Address = {-| The server name is a combination of a hostname and an optional port. -} -type ServerName - = ServerName { host : HostName, port_ : Maybe Int } +type alias ServerName = + { host : HostName, port_ : Maybe Int } {-| Parser for the DNS name record. The Matrix spec bases its grammar on the @@ -214,7 +214,7 @@ portParser = servernameParser : Parser ServerName servernameParser = - P.succeed (\h p -> ServerName { host = h, port_ = p }) + P.succeed ServerName |= hostnameParser |= P.oneOf [ P.succeed Just @@ -225,7 +225,7 @@ servernameParser = toString : ServerName -> String -toString (ServerName { host, port_ }) = +toString { host, port_ } = let hostString : String hostString = diff --git a/src/Internal/Grammar/UserId.elm b/src/Internal/Grammar/UserId.elm index be433ba..2a2327f 100644 --- a/src/Internal/Grammar/UserId.elm +++ b/src/Internal/Grammar/UserId.elm @@ -43,8 +43,8 @@ import Internal.Tools.ParserExtra as PE import Parser as P exposing ((|.), (|=), Parser) -type UserID - = UserID { localpart : String, domain : ServerName } +type alias UserID = + { localpart : String, domain : ServerName } fromString : String -> Maybe UserID @@ -61,13 +61,13 @@ localpartParser = toString : UserID -> String -toString (UserID { localpart, domain }) = +toString { localpart, domain } = String.concat [ "@", localpart, ":", ServerName.toString domain ] userIdParser : Parser UserID userIdParser = - P.succeed (\l d -> UserID { localpart = l, domain = d }) + P.succeed UserID |. P.symbol "@" |= localpartParser |. P.symbol ":"