It took me the afternoon but I got a LSP working
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
module Part1 where
|
||||
|
||||
import Commons
|
||||
import Data.Char
|
||||
|
||||
|
||||
getCalibrationValuePart :: CalibrationLine -> Char
|
||||
getCalibrationValuePart (h: _) | h >= '0' && h <= '9' = h
|
||||
getCalibrationValuePart (h: _) | isDigit h = h
|
||||
getCalibrationValuePart (_: t) = getCalibrationValuePart t
|
||||
|
||||
getCalibrationValue :: CalibrationLine -> Integer
|
||||
getCalibrationValue line = read [(getCalibrationValuePart line), (getCalibrationValuePart (reverse line))]
|
||||
getCalibrationValue line = read [getCalibrationValuePart line, getCalibrationValuePart (reverse line)]
|
||||
|
||||
getCalibrationValues :: CalibrationDocument -> [Integer]
|
||||
getCalibrationValues (h: []) = [(getCalibrationValue h)]
|
||||
getCalibrationValues (h: t) = ((getCalibrationValue h): (getCalibrationValues t))
|
||||
getCalibrationValues [h] = [getCalibrationValue h]
|
||||
getCalibrationValues (h: t) = getCalibrationValue h: getCalibrationValues t
|
||||
|
||||
Reference in New Issue
Block a user