generated from tpl/purs
fix: trim start
This commit is contained in:
parent
c479776340
commit
01f844b2d2
@ -243,12 +243,15 @@ pad n pq@(Proquint segs) =
|
||||
else
|
||||
pq
|
||||
|
||||
trim :: Proquint -> Proquint
|
||||
trim (Proquint segs) = Proquint $ Array.dropWhile (_ == segmentZero) segs
|
||||
|
||||
toString :: Proquint -> String
|
||||
toString (Proquint segments) = intercalate "-" $ map segmentToString segments
|
||||
|
||||
fromString :: String -> Either String Proquint
|
||||
fromString "" = Right $ Proquint []
|
||||
fromString s = map Proquint $ traverse segmentFromString $ String.split (wrap "-") s
|
||||
fromString s = map (trim <<< Proquint) $ traverse segmentFromString $ String.split (wrap "-") s
|
||||
|
||||
fromInt :: Int -> Proquint
|
||||
fromInt n = fromBits $ unsafePerformEffect do
|
||||
@ -292,4 +295,4 @@ fromBits buf =
|
||||
| x >= len = segs
|
||||
| otherwise = go (segs <> [ segmentFromBits $ octets x ]) (x + 2)
|
||||
in
|
||||
Proquint $ go [] 0
|
||||
trim $ Proquint $ go [] 0
|
||||
|
Loading…
Reference in New Issue
Block a user