diff --git a/pkg/hs/racquire/package.yaml b/pkg/hs/racquire/package.yaml index 36b562d11..b882b2753 100644 --- a/pkg/hs/racquire/package.yaml +++ b/pkg/hs/racquire/package.yaml @@ -9,7 +9,6 @@ library: - -fwarn-incomplete-patterns - -fwarn-unused-binds - -fwarn-unused-imports - - -Werror - -O2 dependencies: diff --git a/pkg/hs/urbit-king/lib/Urbit/Arvo/Common.hs b/pkg/hs/urbit-king/lib/Urbit/Arvo/Common.hs index 19f97d979..645b8a1f7 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Arvo/Common.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Arvo/Common.hs @@ -20,6 +20,8 @@ module Urbit.Arvo.Common import Urbit.Prelude hiding (Term) +import Control.Monad.Fail (fail) + import qualified Network.HTTP.Types.Method as H import qualified Urbit.Ob as Ob diff --git a/pkg/hs/urbit-king/lib/Urbit/Arvo/Effect.hs b/pkg/hs/urbit-king/lib/Urbit/Arvo/Effect.hs index f79b2a787..b6a2bd174 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Arvo/Effect.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Arvo/Effect.hs @@ -12,6 +12,7 @@ module Urbit.Arvo.Effect where import Urbit.Noun.Time import Urbit.Prelude +import Control.Monad.Fail (fail) import Urbit.Arvo.Common (KingId(..), ServId(..)) import Urbit.Arvo.Common (Header, HttpEvent, HttpServerConf, Method, Mime) import Urbit.Arvo.Common (AmesDest, Turf) diff --git a/pkg/hs/urbit-king/lib/Urbit/Arvo/Event.hs b/pkg/hs/urbit-king/lib/Urbit/Arvo/Event.hs index 583c4ed64..f95166a49 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Arvo/Event.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Arvo/Event.hs @@ -11,6 +11,7 @@ module Urbit.Arvo.Event where import Urbit.Prelude hiding (Term) +import Control.Monad.Fail (fail) import Urbit.Arvo.Common (KingId(..), ServId(..)) import Urbit.Arvo.Common (Desk, Mime) import Urbit.Arvo.Common (Header(..), HttpEvent) diff --git a/pkg/hs/urbit-king/lib/Urbit/King/Main.hs b/pkg/hs/urbit-king/lib/Urbit/King/Main.hs index bba16c090..2a21a144a 100644 --- a/pkg/hs/urbit-king/lib/Urbit/King/Main.hs +++ b/pkg/hs/urbit-king/lib/Urbit/King/Main.hs @@ -90,11 +90,8 @@ import Urbit.King.App import Control.Concurrent (myThreadId) import Control.Exception (AsyncException(UserInterrupt)) -import Control.Lens ((&)) import System.Process (system) import System.IO (hPutStrLn) -import Text.Show.Pretty (pPrint) -import Urbit.Noun.Conversions (cordToUW) import Urbit.Noun.Time (Wen) import Urbit.Vere.LockFile (lockFile) diff --git a/pkg/hs/urbit-king/lib/Urbit/Prelude.hs b/pkg/hs/urbit-king/lib/Urbit/Prelude.hs index eee5cef16..cf9aae210 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Prelude.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Prelude.hs @@ -20,10 +20,9 @@ module Urbit.Prelude import ClassyPrelude import Urbit.Noun -import Control.Lens hiding (Each, Index, cons, index, snoc, uncons, unsnoc, - (<.>), (<|)) - import Control.Arrow ((<<<), (>>>)) +import Control.Lens hiding (Each, Index, cons, index, snoc, uncons, unsnoc, + (<.>), (<|)) import Data.Acquire (Acquire, mkAcquire, with) import Data.RAcquire (RAcquire, mkRAcquire, rwith) import Data.RAcquire (MonadAcquire(..), MonadRIO(..)) diff --git a/pkg/hs/urbit-king/lib/Urbit/Vere/Dawn.hs b/pkg/hs/urbit-king/lib/Urbit/Vere/Dawn.hs index 571cca505..41d165577 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Vere/Dawn.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Vere/Dawn.hs @@ -19,7 +19,6 @@ import Urbit.Arvo.Common import Urbit.Arvo.Event hiding (Address) import Urbit.Prelude hiding (Call, rights, to, (.=)) -import Data.Bifunctor (bimap) import Data.Bits (xor) import Data.List (nub) import Data.Text (splitOn) @@ -351,10 +350,10 @@ validateShipAndGetSponsor endpoint block (Seed ship life ring oaf) = -- A comet address is the fingerprint of the keypair let shipFromPass = cometFingerprint $ ringToPass ring when (ship /= shipFromPass) $ - fail ("comet name doesn't match fingerprint " <> show ship <> " vs " <> + error ("comet name doesn't match fingerprint " <> show ship <> " vs " <> show shipFromPass) when (life /= 1) $ - fail ("comet can never be re-keyed") + error ("comet can never be re-keyed") pure (shipSein ship) validateMoon = do @@ -368,14 +367,14 @@ validateShipAndGetSponsor endpoint block (Seed ship life ring oaf) = whoP <- retrievePoint endpoint block ship case epNet whoP of - Nothing -> fail "ship not keyed" + Nothing -> error "ship not keyed" Just (netLife, pass, contNum, (hasSponsor, who), _) -> do when (netLife /= life) $ - fail ("keyfile life mismatch; keyfile claims life " <> + error ("keyfile life mismatch; keyfile claims life " <> show life <> ", but Azimuth claims life " <> show netLife) when ((ringToPass ring) /= pass) $ - fail "keyfile does not match blockchain" + error "keyfile does not match blockchain" -- TODO: The hoon code does a breach check, but the C code never -- supplies the data necessary for it to function. pure who @@ -391,16 +390,16 @@ getSponsorshipChain endpoint block = loop ethPoint <- retrievePoint endpoint block ship case (clanFromShip ship, epNet ethPoint) of - (Ob.Comet, _) -> fail "Comets cannot be sponsors" - (Ob.Moon, _) -> fail "Moons cannot be sponsors" + (Ob.Comet, _) -> error "Comets cannot be sponsors" + (Ob.Moon, _) -> error "Moons cannot be sponsors" (_, Nothing) -> - fail $ unpack ("Ship " <> renderShip ship <> " not booted") + error $ unpack ("Ship " <> renderShip ship <> " not booted") (Ob.Galaxy, Just _) -> pure [(ship, ethPoint)] (_, Just (_, _, _, (False, _), _)) -> - fail $ unpack ("Ship " <> renderShip ship <> " has no sponsor") + error $ unpack ("Ship " <> renderShip ship <> " has no sponsor") (_, Just (_, _, _, (True, sponsor), _)) -> do chain <- loop sponsor diff --git a/pkg/hs/urbit-king/lib/Urbit/Vere/Pier.hs b/pkg/hs/urbit-king/lib/Urbit/Vere/Pier.hs index 6e920685c..6b712c474 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Vere/Pier.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Vere/Pier.hs @@ -26,7 +26,7 @@ import Urbit.Vere.Pier.Types import Control.Monad.STM (retry) import System.Environment (getExecutablePath) -import System.FilePath (splitFileName, ()) +import System.FilePath (splitFileName) import System.Posix.Files (ownerModes, setFileMode) import Urbit.EventLog.LMDB (EventLog) import Urbit.King.API (TermConn) diff --git a/pkg/hs/urbit-king/lib/Urbit/Vere/Term/API.hs b/pkg/hs/urbit-king/lib/Urbit/Vere/Term/API.hs index c94f5198f..7e65d49e5 100644 --- a/pkg/hs/urbit-king/lib/Urbit/Vere/Term/API.hs +++ b/pkg/hs/urbit-king/lib/Urbit/Vere/Term/API.hs @@ -13,6 +13,7 @@ import Urbit.Prelude hiding (trace) import Urbit.Arvo (Belt, Blit) +import Control.Monad.Fail (fail) import Urbit.TermSize -- External Types -------------------------------------------------------------- diff --git a/pkg/hs/urbit-noun-core/lib/Urbit/Noun/Cue.hs b/pkg/hs/urbit-noun-core/lib/Urbit/Noun/Cue.hs index 0bc122fb3..7fcc79ff4 100644 --- a/pkg/hs/urbit-noun-core/lib/Urbit/Noun/Cue.hs +++ b/pkg/hs/urbit-noun-core/lib/Urbit/Noun/Cue.hs @@ -12,14 +12,15 @@ import ClassyPrelude import Urbit.Atom import Urbit.Noun.Core -import Data.Bits (shiftL, shiftR, (.&.), (.|.)) -import Data.Function ((&)) -import Foreign.Ptr (Ptr, castPtr, plusPtr, ptrToWordPtr) -import Foreign.Storable (peek) -import GHC.Prim (ctz#) -import GHC.Word (Word(..)) -import System.IO.Unsafe (unsafePerformIO) -import Text.Printf (printf) +import Control.Monad.Fail (MonadFail (fail)) +import Data.Bits (shiftL, shiftR, (.&.), (.|.)) +import Data.Function ((&)) +import Foreign.Ptr (Ptr, castPtr, plusPtr, ptrToWordPtr) +import Foreign.Storable (peek) +import GHC.Prim (ctz#) +import GHC.Word (Word(..)) +import System.IO.Unsafe (unsafePerformIO) +import Text.Printf (printf) import qualified Data.ByteString.Unsafe as BS import qualified Data.HashTable.IO as H @@ -136,6 +137,7 @@ instance Monad Get where runGet (f x') end tbl s' {-# INLINE (>>=) #-} +instance MonadFail Get where fail msg = Get $ \end tbl s -> do badEncoding end s msg {-# INLINE fail #-} diff --git a/pkg/hs/urbit-noun-core/lib/Urbit/Noun/TH.hs b/pkg/hs/urbit-noun-core/lib/Urbit/Noun/TH.hs index 641161d1d..f2a97569a 100644 --- a/pkg/hs/urbit-noun-core/lib/Urbit/Noun/TH.hs +++ b/pkg/hs/urbit-noun-core/lib/Urbit/Noun/TH.hs @@ -4,6 +4,7 @@ module Urbit.Noun.TH (deriveNoun, deriveToNoun, deriveFromNoun) where import ClassyPrelude hiding (fromList) +import Control.Monad.Fail (fail) import Language.Haskell.TH import Language.Haskell.TH.Syntax import Urbit.Noun.Convert diff --git a/pkg/hs/urbit-noun/lib/Urbit/Noun/Conversions.hs b/pkg/hs/urbit-noun/lib/Urbit/Noun/Conversions.hs index 6a8b5fddf..44169d216 100644 --- a/pkg/hs/urbit-noun/lib/Urbit/Noun/Conversions.hs +++ b/pkg/hs/urbit-noun/lib/Urbit/Noun/Conversions.hs @@ -17,6 +17,7 @@ module Urbit.Noun.Conversions import ClassyPrelude hiding (hash) import Control.Lens hiding (Each, Index, (<.>)) +import Control.Monad.Fail (fail) import Data.Void import Data.Word import Text.Regex.TDFA @@ -33,7 +34,7 @@ import GHC.Types (Char(C#)) import GHC.Word (Word32(W32#)) import Prelude ((!!)) import RIO.FilePath (joinPath, splitDirectories, takeBaseName, - takeDirectory, takeExtension, (<.>)) + takeDirectory, takeExtension) import Urbit.Noun.Cue (cue) import Urbit.Noun.Jam (jam)