Skip to content

Commit

Permalink
Remove NoImplicitPrelude from cardano-api.
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Jan 23, 2023
1 parent 9665b3d commit 18416b5
Show file tree
Hide file tree
Showing 75 changed files with 69 additions and 179 deletions.
5 changes: 2 additions & 3 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ extra-source-files: README.md, ChangeLog.md

common project-config
default-language: Haskell2010
default-extensions: NoImplicitPrelude
OverloadedStrings
default-extensions: OverloadedStrings
build-depends: base >= 4.14 && < 4.15

ghc-options: -Wall
Expand Down Expand Up @@ -211,6 +210,7 @@ test-suite cardano-api-test
type: exitcode-stdio-1.0

build-depends: aeson >= 1.5.6.0
, bytestring
, cardano-api
, cardano-api:gen
, cardano-data ^>= 0.1
Expand All @@ -219,7 +219,6 @@ test-suite cardano-api-test
, cardano-crypto-test ^>= 1.4
, cardano-crypto-tests ^>= 2.0
, cardano-ledger-core ^>= 0.1
, cardano-prelude
, cardano-slotting ^>= 0.1
, containers
, hedgehog
Expand Down
6 changes: 2 additions & 4 deletions cardano-api/gen/Gen/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ module Gen.Cardano.Api
, genAlonzoGenesis
) where

import Cardano.Prelude
import Cardano.Prelude (panic)

import Cardano.Api.Shelley as Api

import Control.Monad (MonadFail (fail))
import qualified Data.Map.Strict as Map
import qualified Data.Text as Text
import Data.Word (Word64)

--TODO: why do we have this odd split? We can get rid of the old name "typed"
import Gen.Cardano.Api.Typed (genCostModel, genRational)
Expand All @@ -26,7 +26,6 @@ import qualified Cardano.Ledger.BaseTypes as Ledger
import qualified Cardano.Ledger.Coin as Ledger
import Cardano.Ledger.Shelley.Metadata (Metadata (..), Metadatum (..))


import Hedgehog (Gen, Range)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Internal.Range as Range
Expand Down Expand Up @@ -97,7 +96,6 @@ genCostModels = do
Right alonzoCostModel ->
Alonzo.CostModels . conv <$> Gen.list (Range.linear 1 3) (return alonzoCostModel)
where
conv :: [Alonzo.CostModel] -> Map Alonzo.Language Alonzo.CostModel
conv [] = mempty
conv (c : rest) = Map.singleton (Alonzo.getCostModelLanguage c) c <> conv rest

Expand Down
4 changes: 3 additions & 1 deletion cardano-api/gen/Gen/Cardano/Api/Metadata.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ module Gen.Cardano.Api.Metadata
) where

import Cardano.Api
import Cardano.Prelude
import Data.Aeson (ToJSON (..))
import Data.ByteString (ByteString)
import Data.Text (Text)
import Data.Word (Word64)
import Hedgehog (Gen)

import qualified Data.Aeson as Aeson
Expand Down
12 changes: 9 additions & 3 deletions cardano-api/gen/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ module Gen.Cardano.Api.Typed
, genRational
) where

import Cardano.Prelude (panic)

import Cardano.Api hiding (txIns)
import qualified Cardano.Api as Api
import Cardano.Api.Byron (KeyWitness (ByronKeyWitness),
Expand All @@ -116,14 +118,18 @@ import Cardano.Api.Shelley (Hash (ScriptDataHash), KESPeriod (KESPerio
StakeCredential (StakeCredentialByKey), StakePoolKey,
refInsScriptsAndInlineDatsSupportedInEra)

import Cardano.Prelude

import Control.Monad.Fail (fail)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Short as SBS
import Data.Coerce
import Data.Int (Int64)
import Data.Map.Strict (Map)
import Data.Maybe (maybeToList)
import Data.Ratio (Ratio, (%))
import Data.String
import qualified Data.Text as Text
import Data.Word (Word64)
import Numeric.Natural (Natural)

import qualified Cardano.Binary as CBOR
import qualified Cardano.Crypto.Hash as Crypto
Expand Down
3 changes: 0 additions & 3 deletions cardano-api/gen/Gen/Cardano/Crypto/Seed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ module Gen.Cardano.Crypto.Seed

import Cardano.Api (AsType, Key)
import Cardano.Crypto.Seed (Seed)
import Data.Functor ((<$>))
import Data.Int (Int)
import Hedgehog (MonadGen, Range)
import Prelude (fromIntegral)

import qualified Cardano.Api as API
import qualified Cardano.Crypto.Seed as C
Expand Down
1 change: 0 additions & 1 deletion cardano-api/gen/Gen/Hedgehog/Roundtrip/Bech32.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Gen.Hedgehog.Roundtrip.Bech32
) where

import Cardano.Api
import Cardano.Prelude
import Hedgehog (Gen, Property)

import qualified Hedgehog as H
Expand Down
1 change: 0 additions & 1 deletion cardano-api/gen/Gen/Hedgehog/Roundtrip/CBOR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Gen.Hedgehog.Roundtrip.CBOR
) where

import Cardano.Api
import Cardano.Prelude
import Hedgehog (Gen, Property)

import qualified Hedgehog as H
Expand Down
3 changes: 0 additions & 3 deletions cardano-api/src/Cardano/Api/Address.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ module Cardano.Api.Address (
isKeyAddress
) where

import Prelude

import Control.Applicative ((<|>))
import Data.Aeson (FromJSON (..), ToJSON (..), withText, (.=))
import qualified Data.Aeson as Aeson
Expand All @@ -104,7 +102,6 @@ import Cardano.Api.EraCast
import Cardano.Api.Eras
import Cardano.Api.Hash
import Cardano.Api.HasTypeProxy
import Cardano.Api.Keys.Class
import Cardano.Api.Keys.Byron
import Cardano.Api.Keys.Shelley
import Cardano.Api.NetworkId
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ module Cardano.Api.Block (
makeChainTip,
) where

import Prelude

import Data.Aeson (FromJSON (..), ToJSON (..), object, (.=))
import qualified Data.Aeson as Aeson
import qualified Data.ByteString as BS
Expand Down
4 changes: 1 addition & 3 deletions cardano-api/src/Cardano/Api/Certificate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ module Cardano.Api.Certificate (
AsType(..)
) where

import Prelude

import Data.ByteString (ByteString)
import qualified Data.Foldable as Foldable
import qualified Data.Map.Strict as Map
Expand All @@ -62,8 +60,8 @@ import Cardano.Ledger.Shelley.TxBody (MIRPot (..))
import qualified Cardano.Ledger.Shelley.TxBody as Shelley

import Cardano.Api.Address
import Cardano.Api.HasTypeProxy
import Cardano.Api.Hash
import Cardano.Api.HasTypeProxy
import Cardano.Api.Keys.Byron
import Cardano.Api.Keys.Praos
import Cardano.Api.Keys.Shelley
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/Convenience/Construction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ module Cardano.Api.Convenience.Construction (

) where

import Prelude

import qualified Data.List as List
import qualified Data.Map.Strict as Map
import Data.Set (Set)
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/Convenience/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ module Cardano.Api.Convenience.Query (
renderQueryConvenienceError,
) where

import Prelude

import Control.Monad.Trans.Except (ExceptT (..), except, runExceptT)
import Control.Monad.Trans.Except.Extra (firstExceptT, hoistMaybe)
import Data.Bifunctor (first)
Expand Down
6 changes: 3 additions & 3 deletions cardano-api/src/Cardano/Api/Crypto/Ed25519Bip32.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ module Cardano.Api.Crypto.Ed25519Bip32
)
where

import Cardano.Prelude hiding (show)
import Prelude (show)

import Control.DeepSeq (NFData)
import Data.ByteArray as BA (ByteArrayAccess, ScrubbedBytes, convert)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import GHC.Generics (Generic)
import NoThunks.Class (InspectHeap (..), NoThunks)

import Cardano.Binary (FromCBOR (..), ToCBOR (..))
Expand Down
4 changes: 1 addition & 3 deletions cardano-api/src/Cardano/Api/DeserialiseAnyOf.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ module Cardano.Api.DeserialiseAnyOf
, renderSomeAddressVerificationKey
) where

import Prelude

import qualified Data.Aeson as Aeson
import Data.Bifunctor (first)
import Data.ByteString (ByteString)
Expand All @@ -42,8 +40,8 @@ import Cardano.Api.SerialiseTextEnvelope

-- TODO: Think about if these belong
import Cardano.Api.Address
import Cardano.Api.Keys.Class
import Cardano.Api.Keys.Byron
import Cardano.Api.Keys.Class
import Cardano.Api.Keys.Praos
import Cardano.Api.Keys.Shelley

Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/Environment.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module Cardano.Api.Environment
, renderEnvSocketError
) where

import Prelude

import Data.Aeson
import Data.Text (Text)
import qualified Data.Text as Text
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/EraCast.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ module Cardano.Api.EraCast
) where

import Cardano.Api.Eras (CardanoEra (..), IsCardanoEra)
import Data.Either (Either)
import Data.Kind (Type)
import Text.Show (Show (..))

data EraCastError = forall fromEra toEra value.
( IsCardanoEra fromEra
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/Eras.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ module Cardano.Api.Eras
AsByron, AsShelley, AsAllegra, AsMary, AsAlonzo, AsBabbage)
) where

import Prelude

import Cardano.Api.HasTypeProxy

import Control.DeepSeq
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ module Cardano.Api.Error
, FileError(..)
) where

import Prelude

import Control.Exception (Exception (..), IOException, throwIO)
import System.IO (Handle)

Expand Down
6 changes: 2 additions & 4 deletions cardano-api/src/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ module Cardano.Api.Fees (
toLedgerEpochInfo,
) where

import Prelude

import qualified Data.Array as Array
import Data.Bifunctor (bimap, first)
import qualified Data.ByteString as BS
Expand All @@ -55,8 +53,8 @@ import Data.Set (Set)
import qualified Data.Set as Set
import qualified Data.Text as Text
import GHC.Records (HasField (..))
import Numeric.Natural
import Lens.Micro ((^.))
import Numeric.Natural

import Control.Monad.Trans.Except
import qualified Prettyprinter as PP
Expand Down Expand Up @@ -947,7 +945,7 @@ makeTransactionBodyAutoBalance eraInMode systemstart history pparams
-- 4. balance the transaction and update tx change output
txbody0 <-
first TxBodyError $ createAndValidateTransactionBody txbodycontent
{ txOuts = txOuts txbodycontent ++
{ txOuts = txOuts txbodycontent ++
[TxOut changeaddr (lovelaceToTxOutValue 0) TxOutDatumNone ReferenceScriptNone]
--TODO: think about the size of the change output
-- 1,2,4 or 8 bytes?
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ module Cardano.Api.Genesis
, shelleyGenesisDefaults
) where

import Prelude

import qualified Data.ListMap as ListMap
import qualified Data.Map.Strict as Map
import Data.Maybe (fromMaybe)
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/GenesisParameters.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ module Cardano.Api.GenesisParameters (

) where

import Prelude

import Data.Time (NominalDiffTime, UTCTime)

import Cardano.Slotting.Slot (EpochSize (..))
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/IPC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ module Cardano.Api.IPC (
NodeToClientVersion(..)
) where

import Prelude

import Data.Void (Void)

import Data.Aeson (ToJSON, object, toJSON, (.=))
Expand Down
5 changes: 0 additions & 5 deletions cardano-api/src/Cardano/Api/IPC/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ module Cardano.Api.IPC.Monad
, determineEraExpr
) where

import Control.Applicative
import Control.Concurrent.STM
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Reader
import Control.Monad.Trans.Cont
import Data.Bifunctor (first)
import Data.Either
import Data.Function
import Data.Maybe
import System.IO

import Cardano.Ledger.Shelley.Scripts ()
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Client as Net.Query
Expand Down
3 changes: 0 additions & 3 deletions cardano-api/src/Cardano/Api/IPC/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ module Cardano.Api.IPC.Version
, UnsupportedNtcVersionError(..)
) where

import Data.Eq (Eq)
import Text.Show (Show)

import Ouroboros.Network.NodeToClient.Version (NodeToClientVersion (..))

-- | The query 'a' is a versioned query, which means it requires the Node to support a minimum
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/src/Cardano/Api/InMode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ module Cardano.Api.InMode (
fromConsensusApplyTxErr,
) where

import Prelude

import Data.SOP.Strict (NS (S, Z))

import qualified Ouroboros.Consensus.Byron.Ledger as Consensus
Expand Down
3 changes: 0 additions & 3 deletions cardano-api/src/Cardano/Api/Json.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ module Cardano.Api.Json
) where

import Data.Aeson
import Data.Either
import Data.Maybe
import Data.Scientific
import GHC.Real

-- Rationals and JSON are an awkward mix. We cannot convert rationals
-- like @1/3@ to JSON numbers. But _most_ of the numbers we want to use
Expand Down
Loading

0 comments on commit 18416b5

Please sign in to comment.