Commit ee5a3aa2 authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Removed unused error functions

parent a3e0d054
module Base.Messages
( -- * Output of user information
info, status
-- * Error messages
, putErrLn, putErrsLn
info, status, putErrLn, putErrsLn
-- * program abortion
, abortWith, internalError, errorAt, errorAt', errorMessage, errorMessages
, abortWith, internalError, errorMessage, errorMessages
-- * creating messages
, Message, toMessage, posErr, qposErr, mposErr
) where
......@@ -16,7 +14,6 @@ import System.Exit (ExitCode (..), exitWith)
import Curry.Base.Ident (ModuleIdent (..), Ident (..), QualIdent
, positionOfQualIdent)
import Curry.Base.MessageMonad (Message, toMessage)
import Curry.Base.Position (Position)
import CompilerOpts (Options (optVerbosity), Verbosity (..))
......@@ -44,14 +41,6 @@ abortWith errs = putErrsLn errs >> exitWith (ExitFailure 1)
internalError :: String -> a
internalError msg = error $ "Internal error: " ++ msg
-- |Raise an error for a given position
errorAt :: Position -> String -> a
errorAt p msg = error ('\n' : (show $ toMessage p msg))
-- |Raise an error for a given position, uncurried
errorAt' :: (Position, String) -> a
errorAt' = uncurry errorAt
errorMessage :: Message -> a
errorMessage = error . show
......
......@@ -27,7 +27,7 @@ of the operators involved.
> import Curry.Syntax
> import Base.Expr
> import Base.Messages (Message, toMessage)
> import Base.Messages (Message, posErr, qposErr)
> import Base.Utils (findDouble)
> import Env.OpPrec (PEnv, OpPrec (..), PrecInfo (..), defaultP, bindP
......@@ -503,11 +503,8 @@ Error messages.
> ++ " with " ++ qualName op2 ++ (showLine $ positionOfQualIdent op2)
> errAmbiguousParse :: String -> QualIdent -> QualIdent -> Message
> errAmbiguousParse what op1 op2 = toMessage (positionOfQualIdent op1) $
> errAmbiguousParse what op1 op2 = qposErr op1 $
> "Ambiguous use of " ++ what ++ " " ++ qualName op1
> ++ " with " ++ qualName op2 ++ (showLine $ positionOfQualIdent op2)
> posErr :: Ident -> String -> Message
> posErr i msg = toMessage (positionOfIdent i) msg
\end{verbatim}
......@@ -26,7 +26,7 @@ import Curry.Base.Position
import Curry.Syntax
import Base.CurryTypes (fromType)
import Base.Messages (internalError, errorAt)
import Base.Messages (internalError)
import Base.TopEnv
import Base.Types
......@@ -152,8 +152,8 @@ genTypeDecl env (TypeDecl _ n vs ty)
)
where (env1, idxs) = mapAccumL genTVarIndex env vs
(env2, ty' ) = genTypeExpr env1 ty
genTypeDecl _ (NewtypeDecl pos _ _ _)
= errorAt pos "newtype declarations are not supported in AbstractCurry"
genTypeDecl _ (NewtypeDecl _ _ _ _)
= internalError "newtype declarations are not supported in AbstractCurry"
genTypeDecl _ _
= internalError "GenAbstractCurry.genTypeDecl: unexpected declaration"
......@@ -420,8 +420,8 @@ genLocalDecls env decls
(foldr (\p1 p2 -> ConstructorPattern qConsId [p1,p2])
(ConstructorPattern qNilId [])
args)
genLocalPattern pos _ (NegativePattern _ _)
= errorAt pos "negative patterns are not supported in AbstractCurry"
genLocalPattern _ _ (NegativePattern _ _)
= internalError "negative patterns are not supported in AbstractCurry"
genLocalPattern pos env' (AsPattern ident cterm)
= let (env1, patt) = genLocalPattern pos env' cterm
idx = fromMaybe
......@@ -443,8 +443,8 @@ genLocalDecls env decls
genLocalPattRhs pos env' [(Variable _, expr)]
= genExpr pos env' expr
genLocalPattRhs pos _ _
= errorAt pos ("guarded expressions in pattern declarations"
genLocalPattRhs _ _ _
= internalError ("guarded expressions in pattern declarations"
++ " are not supported in AbstractCurry")
--
......@@ -557,7 +557,7 @@ genBranchExpr env (Alt pos patt rhs)
genBranchRhs env' [(Variable _, expr)]
= genExpr pos env' expr
genBranchRhs _ _
= errorAt pos ("guarded expressions in case alternatives"
= internalError ("guarded expressions in case alternatives"
++ " are not supported in AbstractCurry")
--
......@@ -583,8 +583,8 @@ genPattern pos env (ListPattern _ args) = genPattern pos env $
foldr (\x1 x2 -> ConstructorPattern qConsId [x1, x2])
(ConstructorPattern qNilId [])
args
genPattern pos _ (NegativePattern _ _)
= errorAt pos "negative patterns are not supported in AbstractCurry"
genPattern _ _ (NegativePattern _ _)
= internalError "negative patterns are not supported in AbstractCurry"
genPattern pos env (AsPattern ident cterm)
= let (env1, patt) = genPattern pos env cterm
(env2, idx ) = genVarIndex env1 ident
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment