Skip to content

Commit

Permalink
Hide non-exhaustive pattern match
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBlom committed May 2, 2023
1 parent 8c30a3d commit 2b20375
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ type Comparator a = a -> a -> Ordering
type Product2 a = (a, [(a, a)])

isPalindrome :: Integral a => a -> Bool
isPalindrome x = x < base || lastDigit /= 0 && digits == reverse digits
isPalindrome x = x < base || last digits /= 0 && digits == reverse digits
where base = 10
digits@(lastDigit:_) = revDigitsBase base x
digits = revDigitsBase base x

revDigitsBase :: Integral a => a -> a -> [a]
revDigitsBase base = go
Expand Down

0 comments on commit 2b20375

Please sign in to comment.