Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fosskers committed Jan 24, 2021
1 parent e0e6d38 commit 31ee0b3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Data/Versions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ import Control.Monad (void)
import Data.Bool (bool)
import Data.Char (isAlpha)
import Data.Foldable (fold)
import Data.Functor (($>))
import Data.Hashable (Hashable)
import Data.List (intersperse)
import Data.List.NonEmpty (NonEmpty(..))
Expand Down Expand Up @@ -791,19 +790,19 @@ chunk :: Parsec Void Text VChunk
chunk = try zeroWithLetters <|> oneZero <|> PC.some (iunit <|> sunit)
where
oneZero :: Parsec Void Text (NonEmpty VUnit)
oneZero = (:|[]) . Digits . read . T.unpack <$> string "0"
oneZero = (Digits 0 :| []) <$ single '0'

zeroWithLetters :: Parsec Void Text (NonEmpty VUnit)
zeroWithLetters = do
z <- Digits . read . T.unpack <$> string "0"
z <- Digits 0 <$ single '0'
s <- PC.some sunit
c <- optional chunk
case c of
Nothing -> pure $ NEL.cons z s
Just c' -> pure $ NEL.cons z s <> c'

iunit :: Parsec Void Text VUnit
iunit = Digits <$> ((single '0' $> 0) <|> (read <$> some digitChar))
iunit = Digits <$> ((0 <$ single '0') <|> (read <$> some digitChar))

sunit :: Parsec Void Text VUnit
sunit = Str . T.pack <$> some letterChar
Expand Down

0 comments on commit 31ee0b3

Please sign in to comment.