From 7f0066cafd2a91959ef618ef8342524ca30a328f Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Wed, 13 Mar 2024 06:16:50 +0100 Subject: review: request-changes feature/review --- app/Git.hs | 6 +++++- app/Git/CommitHash.hs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Git.hs b/app/Git.hs index fd4fa53..eae3a85 100644 --- a/app/Git.hs +++ b/app/Git.hs @@ -95,8 +95,12 @@ readTextFileOfText :: CommitHash -> FilePath -> IO LT.Text readTextFileOfText = readTextFileOf LT.readFile LT.decodeUtf8 readTextFileOfBS :: CommitHash -> FilePath -> IO LB.ByteString -readTextFileOfBS = readTextFileOf LB.readFile (\x -> x) +readTextFileOfBS = readTextFileOf LB.readFile id -- REVIEW Suggestion: we could use `id` instead of `\x -> x` +-- +-- REVIEW OK! +-- +-- RESOLVED readTextFileOf :: (FilePath -> IO a) -> (LB.ByteString -> a) -> CommitHash -> FilePath -> IO a readTextFileOf readFile _ WorkingTree filePath = diff --git a/app/Git/CommitHash.hs b/app/Git/CommitHash.hs index c53e2d8..28aa738 100644 --- a/app/Git/CommitHash.hs +++ b/app/Git/CommitHash.hs @@ -27,8 +27,12 @@ toText (Commit hash) = Just hash toTextUnsafe :: CommitHash -> T.Text toTextUnsafe (Commit hash) = hash toTextUnsafe _ = error "toTextUnsafe: WorkingDir" +-- ^ REVIEW Why is this unsafe? +-- +-- REVIEW Because it is a partial function. +-- +-- RESOLVED --- REVIEW Why is this unsafe? instance P.Render CommitHash where render = P.render . P.Detailed -- cgit v1.2.3