rc #13

Merged
crumbtoo merged 196 commits from dev into main 2024-02-13 13:22:23 -07:00
3 changed files with 11 additions and 10 deletions
Showing only changes of commit 692d22afb9 - Show all commits

View File

@@ -60,7 +60,7 @@ import System.Exit
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
newtype RLPCT m a = RLPCT { newtype RLPCT m a = RLPCT {
runRLPCT :: ReaderT RLPCOptions (ErrorfulT RlpcError m) a runRLPCT :: ReaderT RLPCOptions (ErrorfulT (MsgEnvelope RlpcError) m) a
} }
deriving (Functor, Applicative, Monad) deriving (Functor, Applicative, Monad)
@@ -70,7 +70,7 @@ type RLPCIO = RLPCT IO
evalRLPC :: RLPCOptions evalRLPC :: RLPCOptions
-> RLPC a -> RLPC a
-> (Maybe a, [RlpcError]) -> (Maybe a, [MsgEnvelope RlpcError])
evalRLPC opt r = runRLPCT r evalRLPC opt r = runRLPCT r
& flip runReaderT opt & flip runReaderT opt
& runErrorful & runErrorful
@@ -78,7 +78,7 @@ evalRLPC opt r = runRLPCT r
evalRLPCT :: (Monad m) evalRLPCT :: (Monad m)
=> RLPCOptions => RLPCOptions
-> RLPCT m a -> RLPCT m a
-> m (Maybe a, [RlpcError]) -> m (Maybe a, [MsgEnvelope RlpcError])
evalRLPCT = undefined evalRLPCT = undefined
evalRLPCIO :: RLPCOptions -> RLPCIO a -> IO a evalRLPCIO :: RLPCOptions -> RLPCIO a -> IO a
@@ -89,11 +89,11 @@ evalRLPCIO opt r = do
Just x -> pure x Just x -> pure x
Nothing -> die "Failed, no code compiled." Nothing -> die "Failed, no code compiled."
putRlpcErrs :: [RlpcError] -> IO () putRlpcErrs :: [MsgEnvelope RlpcError] -> IO ()
putRlpcErrs = traverse_ print putRlpcErrs = traverse_ print
liftErrorful :: (Monad m, IsRlpcError e) => ErrorfulT e m a -> RLPCT m a liftErrorful :: (Monad m, IsRlpcError e) => ErrorfulT (MsgEnvelope e) m a -> RLPCT m a
liftErrorful e = RLPCT $ lift (liftRlpcErrors e) liftErrorful e = RLPCT $ lift (fmap liftRlpcError `mapErrorful` e)
data RLPCOptions = RLPCOptions data RLPCOptions = RLPCOptions
{ _rlpcLogFile :: Maybe FilePath { _rlpcLogFile :: Maybe FilePath

View File

@@ -26,7 +26,7 @@ data MsgEnvelope e = MsgEnvelope
, _msgDiagnostic :: e , _msgDiagnostic :: e
, _msgSeverity :: Severity , _msgSeverity :: Severity
} }
deriving Functor deriving (Functor, Show)
newtype RlpcError = Text [Text] newtype RlpcError = Text [Text]
deriving Show deriving Show
@@ -48,6 +48,7 @@ data SrcSpan = SrcSpan
!Int -- ^ Line !Int -- ^ Line
!Int -- ^ Column !Int -- ^ Column
!Int -- ^ Length !Int -- ^ Length
deriving Show
makeLenses ''MsgEnvelope makeLenses ''MsgEnvelope

View File

@@ -101,9 +101,9 @@ checkCoreProg p = scDefs
-- | @checkCoreProgR p@ returns @p@ if @p@ successfully typechecks. -- | @checkCoreProgR p@ returns @p@ if @p@ successfully typechecks.
checkCoreProgR :: Program' -> RLPC Program' checkCoreProgR :: Program' -> RLPC Program'
checkCoreProgR p = do checkCoreProgR p = undefined
liftErrorful (checkCoreProg p)
pure p {-# WARNING checkCoreProgR "unimpl" #-}
-- | Infer the type of an expression under some context. -- | Infer the type of an expression under some context.
-- --