diff options
author | Marvin Borner | 2023-03-11 13:59:57 +0100 |
---|---|---|
committer | Marvin Borner | 2023-03-11 13:59:57 +0100 |
commit | db8c3c4fa194f57c80af39e77d44facef98f9113 (patch) | |
tree | 940f8f7e5dc46004d1df3cdab2c9455f9d994a31 /src/Binary.hs | |
parent | ccda56bb092db65e13d44e8171bbd85815fcd08d (diff) |
Applied linting tips
Diffstat (limited to 'src/Binary.hs')
-rw-r--r-- | src/Binary.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Binary.hs b/src/Binary.hs index a9e8028..79d3fb6 100644 --- a/src/Binary.hs +++ b/src/Binary.hs @@ -14,9 +14,9 @@ import Data.Word ( Word8 ) import Helper toBinary :: Expression -> String -toBinary (Bruijn x ) = (replicate (x + 1) '1') ++ "0" +toBinary (Bruijn x ) = replicate (x + 1) '1' ++ "0" toBinary (Abstraction e ) = "00" ++ toBinary e -toBinary (Application exp1 exp2) = "01" ++ (toBinary exp1) ++ (toBinary exp2) +toBinary (Application exp1 exp2) = "01" ++ toBinary exp1 ++ toBinary exp2 toBinary _ = invalidProgramState fromBinary' :: String -> (Expression, String) @@ -30,10 +30,10 @@ fromBinary' inp = case inp of _ -> invalidProgramState where binaryBruijn rst = - let idx = (length $ takeWhile (== '1') $ inp) - 1 + let idx = length (takeWhile (== '1') inp) - 1 in case rst of - "" -> (Bruijn $ idx, "") - _ -> (Bruijn $ idx, drop idx rst) + "" -> (Bruijn idx, "") + _ -> (Bruijn idx, drop idx rst) fromBinary :: String -> Expression fromBinary = fst . fromBinary' @@ -60,7 +60,7 @@ fromBitString bits = True -> '1' ) $ Bit.toList - $ Bit.take (Bit.length bits - (fromIntegral $ pad bits)) + $ Bit.take (Bit.length bits - fromIntegral (pad bits)) $ Bit.drop 8 bits where pad :: Bit.BitString -> Word8 |