Skip to content

Commit b1c3747

Browse files
committed
Applied review suggestions
1 parent 7c3aee3 commit b1c3747

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lambda-buffers-frontend/src/LambdaBuffers/Frontend.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Data.Text.IO qualified as Text
1717
import Data.Traversable (for)
1818
import LambdaBuffers.Frontend.PPrint ()
1919
import LambdaBuffers.Frontend.Parsec qualified as Parsec
20-
import LambdaBuffers.Frontend.Syntax (Constructor (Constructor), Import (Import, importInfo, importModuleName), Module (moduleImports, moduleName, moduleTyDefs), ModuleAlias (ModuleAlias), ModuleName (ModuleName), ModuleNamePart (ModuleNamePart), Product (Product), SourceInfo (SourceInfo), SourcePos (SourcePos), Ty (TyApp, TyRef', TyVar), TyBody (Opaque, Sum), TyDef (TyDef, tyBody, tyDefInfo, tyName), TyName (TyName), TyRef (TyRef))
20+
import LambdaBuffers.Frontend.Syntax (Constructor (Constructor), Import (Import, importInfo, importModuleName), Module (moduleImports, moduleName, moduleTyDefs), ModuleAlias (ModuleAlias), ModuleName (ModuleName), ModuleNamePart (ModuleNamePart), Product (Product), SourceInfo, Ty (TyApp, TyRef', TyVar), TyBody (Opaque, Sum), TyDef (TyDef, tyBody, tyDefInfo, tyName), TyName (TyName), TyRef (TyRef), defSourceInfo)
2121
import Prettyprinter (Doc, LayoutOptions (layoutPageWidth), PageWidth (Unbounded), Pretty (pretty), defaultLayoutOptions, layoutPretty, (<+>))
2222
import Prettyprinter.Render.String (renderShowS)
2323
import System.Directory (findFiles)
@@ -77,10 +77,10 @@ type FrontendT m a = MonadIO m => ReaderT FrontRead (StateT FrontState (ExceptT
7777
-- | Run a Frontend compilation action on a "lbf" file, return the entire compilation closure or a frontend error.
7878
runFrontend :: MonadIO m => [FilePath] -> FilePath -> m (Either FrontendError FrontendResult)
7979
runFrontend importPaths modFp = do
80-
let stM = runReaderT (processFile modFp) (FrontRead (ModuleName [] defaultSouceInfo)) [] importPaths)
80+
let stM = runReaderT (processFile modFp) (FrontRead (ModuleName [] defSourceInfo) [] importPaths)
8181
exM = runStateT stM (FrontState mempty)
8282
ioM = runExceptT exM
83-
fmap (FrontendResult . importedModules . snd) <$> runExceptT exM
83+
fmap (FrontendResult . importedModules . snd) <$> ioM
8484

8585
throwE' :: FrontendError -> FrontendT m a
8686
throwE' = lift . lift . throwE

lambda-buffers-frontend/src/LambdaBuffers/Frontend/Syntax.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module LambdaBuffers.Frontend.Syntax (
1818
ClassName (..),
1919
SourceInfo (..),
2020
SourcePos (..),
21+
defSourceInfo,
2122
) where
2223

2324
import Data.Text (Text)
@@ -96,3 +97,6 @@ data SourcePos = SourcePos
9697
, column :: Int
9798
}
9899
deriving stock (Eq, Ord, Show)
100+
101+
defSourceInfo :: SourceInfo
102+
defSourceInfo = SourceInfo "" (SourcePos 0 0) (SourcePos 0 0)

0 commit comments

Comments
 (0)