A peer-to-peer stack for code collaboration
Nicer error message and stack traces
Thomas Scholtes5a9554e984f7
diff --git a/src/Radicle/Internal/Annotation.hs b/src/Radicle/Internal/Annotation.hsindex 03ae057..394a078 100644--- a/src/Radicle/Internal/Annotation.hs+++ b/src/Radicle/Internal/Annotation.hs@@ -4,8 +4,9 @@ module Radicle.Internal.Annotation whereimport Codec.Serialise (Serialise)import Data.Copointed (Copointed(..))-import Data.Text (pack)-import Protolude+import qualified Data.Text as T+import GHC.Stack+import Protolude hiding (SrcLoc)import qualified Text.Megaparsec.Pos as Parimport Radicle.Internal.Orphans ()@@ -54,7 +55,10 @@ data SrcPos = SrcPos Par.SourcePosinstance Serialise SrcPosthisPos :: HasCallStack => SrcPos-thisPos = InternalPos (pack (prettyCallStack callStack))+thisPos = InternalPos $ T.intercalate "\n" (map prettyCallSite $ getCallStack callStack)+ where+ prettyCallSite (f, SrcLoc{..}) =+ toS $ srcLocFile <> show srcLocStartLine <> ":" <> show srcLocStartCol <> " " <> fdata WithPos a = WithPos SrcPos aderiving (Read, Show, Generic, Functor, Foldable, Traversable)@@ -73,4 +77,3 @@ instance Copointed WithPos whereinstance Annotation WithPos wheretoAnnotation = WithPos thisPos-diff --git a/src/Radicle/Internal/Pretty.hs b/src/Radicle/Internal/Pretty.hsindex c60d51c..22afa46 100644--- a/src/Radicle/Internal/Pretty.hs+++ b/src/Radicle/Internal/Pretty.hs@@ -72,7 +72,7 @@ instance Pretty Ann.SrcPos whereinstance PrettyV r => PrettyV (LangError r) whereprettyV (LangError stack err) = vsep $- [prettyV err, "Call stack:"] ++ map pretty (reverse stack)+ [prettyV err, indent 2 $ vsep $ map pretty (reverse stack)]instance PrettyV r => PrettyV (LangErrorData r) whereprettyV v = case v of