Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add import lists #115

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion int/Pantry/SHA256.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ import qualified Data.ByteArray
import qualified Data.ByteArray.Encoding as Mem
import Data.StaticBytes
( Bytes32, StaticBytesException, toStaticExact )
import Database.Persist.Sql
import Database.Persist.Class.PersistField ( PersistField (..) )
import Database.Persist.PersistValue ( PersistValue (..) )
import Database.Persist.Sql ( PersistFieldSql (..) )
import Database.Persist.Types ( SqlType (..) )
import RIO
import qualified RIO.Text as T

Expand Down
4 changes: 4 additions & 0 deletions src/Pantry/Casa.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import qualified Data.HashMap.Strict as HM
import qualified Pantry.SHA256 as SHA256
import Pantry.Storage ( storeBlob, withStorage )
import Pantry.Types as P
( BlobKey (..), FileSize (..), HasPantryConfig (..)
, PantryConfig (..), PantryException (..), Tree, TreeKey (..)
, parseTreeM
)
import RIO
import qualified RIO.ByteString as B

Expand Down
12 changes: 6 additions & 6 deletions src/Pantry/HTTP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ import qualified RIO.Text as T
setUserAgent :: Request -> Request
setUserAgent = setRequestHeader "User-Agent" ["Haskell pantry package"]

withResponse
:: MonadUnliftIO m
withResponse ::
MonadUnliftIO m
=> HTTP.Request
-> (Response BodyReader -> m a)
-> m a
withResponse req inner = withRunInIO $ \run -> do
manager <- getGlobalManager
HTTP.withResponse (setUserAgent req) manager (run . inner)

httpSink
:: MonadUnliftIO m
httpSink ::
MonadUnliftIO m
=> Request
-> (Response () -> ConduitT ByteString Void m a)
-> m a
httpSink req = HTTP.httpSink (setUserAgent req)

httpSinkChecked
:: MonadUnliftIO m
httpSinkChecked ::
MonadUnliftIO m
=> Text
-> Maybe SHA256
-> Maybe FileSize
Expand Down
12 changes: 6 additions & 6 deletions src/Pantry/Hackage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ data HackageTarballResult = HackageTarballResult
-- sanity. See the return value to find out if it happened.
--
-- @since 0.1.0.0
updateHackageIndex
:: (HasPantryConfig env, HasLogFunc env)
updateHackageIndex ::
(HasPantryConfig env, HasLogFunc env)
=> Maybe Utf8Builder -- ^ reason for updating, if any
-> RIO env DidUpdateOccur
updateHackageIndex = updateHackageIndexInternal False
Expand All @@ -142,15 +142,15 @@ updateHackageIndex = updateHackageIndexInternal False
-- sure the database is in sync with the locally downloaded tarball
--
-- @since 0.1.0.0
forceUpdateHackageIndex
:: (HasPantryConfig env, HasLogFunc env)
forceUpdateHackageIndex ::
(HasPantryConfig env, HasLogFunc env)
=> Maybe Utf8Builder
-> RIO env DidUpdateOccur
forceUpdateHackageIndex = updateHackageIndexInternal True


updateHackageIndexInternal
:: (HasPantryConfig env, HasLogFunc env)
updateHackageIndexInternal ::
(HasPantryConfig env, HasLogFunc env)
=> Bool -- ^ Force the database update.
-> Maybe Utf8Builder -- ^ reason for updating, if any
-> RIO env DidUpdateOccur
Expand Down
2 changes: 1 addition & 1 deletion src/Pantry/Repo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Pantry.Repo
, withRepo
) where

import Database.Persist ( Entity (..) )
import Database.Persist.Class.PersistEntity ( Entity (..) )
import Pantry.Archive ( getArchivePackage )
import Pantry.Storage
( getTreeForKey, loadPackageById, loadRepoCache
Expand Down
11 changes: 6 additions & 5 deletions src/Pantry/SQLite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ module Pantry.SQLite

import Control.Concurrent.Companion
( Companion, onCompanionDone, withCompanion )
import Database.Persist.Sql ( runSqlConn )
import Database.Persist.Sql.Migration
( Migration, runMigrationSilent )
import Database.Persist.Sqlite
( Migration, extraPragmas, fkEnabled, mkSqliteConnectionInfo
, runMigrationSilent, runSqlConn, walEnabled
, withSqliteConnInfo
( extraPragmas, fkEnabled, mkSqliteConnectionInfo
, walEnabled, withSqliteConnInfo
)
import Pantry.Types
( PantryException (MigrationFailure), Storage (..) )
import Pantry.Types ( PantryException (..), Storage (..) )
import Path ( Abs, File, Path, parent, toFilePath )
import Path.IO ( ensureDir )
import RIO hiding ( FilePath )
Expand Down