Skip to content

Commit

Permalink
Merge pull request #115 from commercialhaskell/imports2
Browse files Browse the repository at this point in the history
Add import lists
  • Loading branch information
mpilgrem authored Nov 1, 2023
2 parents bba0c97 + b992d74 commit e99565a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 19 deletions.
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

0 comments on commit e99565a

Please sign in to comment.