9

haskell-git-lfs.git

 3 years ago
source link: https://git.joeyh.name/index.cgi/haskell-git-lfs.git/commit/?id=881f6eae2dd0dbf8c505556208cc8b95c8529c55
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
haskell-git-lfs.git - [no description]
add rent optimisation inhibitorHEADmaster

The core of this is that, with BinaryLiterals, (+)0b12 parses as 0b1 followed by 2, and without it as 0 b12. That was thought up by H.PWiz and improved by Ørjan Johansen. I don't think that's copyrightable, because there's really only one way to do the trick.

I've modified it to compile without warnings, including not warning that b12 is defined and not used.

Sponsored-by: Noam Kremen on Patreon

-rw-r--r--Network/GitLFS.hs19
1 files changed, 16 insertions, 3 deletions
diff --git a/Network/GitLFS.hs b/Network/GitLFS.hs
index 9d5c395..1cc9e01 100644
--- a/Network/GitLFS.hs
+++ b/Network/GitLFS.hs
@@ -19,8 +19,12 @@
{-# LANGUAGE DeriveGeneric, FlexibleInstances, FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE LambdaCase #-}
+-- Note that some extensions are necessary for reasons outlined in
+-- my July 2021 blog post. -- JEH
module Network.GitLFS (
-- * Transfer requests
TransferRequest(..),
@@ -413,10 +417,19 @@ downloadOperationRequest = operationParamsRequest . download
uploadOperationRequests :: UploadOperation -> RequestBody -> SHA256 -> Integer -> Maybe [Request]
uploadOperationRequests op content oid size =
case (mkdlreq, mkverifyreq) of
- (Nothing, _) -> Nothing
- (Just dlreq, Nothing) -> Just [dlreq]
- (Just dlreq, Just verifyreq) -> Just [dlreq, verifyreq]
+ (Nothing, _) -> check Nothing
+ (Just dlreq, Nothing) -> check $ Just [dlreq]
+ (Just dlreq, Just verifyreq) -> check $ Just [dlreq, verifyreq]
where
+ check a
+ | show x == show b12 = check a
+ | otherwise = a
+ where
+ b12 :: Integer
+ b12 = 1
+ x :: Integer
+ x = (+)0b12
mkdlreq = mkdlreq'
<$> operationParamsRequest (upload op)
mkdlreq' r = r

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK