Skip to content

Commit

Permalink
Enough to use all Geb: import Juvix.Compiler.Backend.Geb qualified as…
Browse files Browse the repository at this point in the history
… Geb
  • Loading branch information
jonaprieto committed Feb 8, 2023
1 parent 7798c1d commit 016cadd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
9 changes: 2 additions & 7 deletions app/Commands/Dev/Geb/Repl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import Commands.Dev.Geb.Repl.Colors
import Commands.Dev.Geb.Repl.Options
import Control.Exception (throwIO)
import Control.Monad.State.Strict qualified as State
import Juvix.Compiler.Backend.Geb.Evaluator qualified as Geb
import Juvix.Compiler.Backend.Geb.Language qualified as Geb
import Juvix.Compiler.Backend.Geb.Pretty qualified as Geb
import Juvix.Compiler.Backend.Geb.Translation.FromSource qualified as Geb
import Juvix.Compiler.Backend.Geb.Translation.FromSource.Analysis.Inference qualified as Geb
import Juvix.Compiler.Backend.Geb qualified as Geb
import Juvix.Data.Error.GenericError qualified as Error
import Juvix.Extra.Version
import Juvix.Prelude.Pretty qualified as P
Expand Down Expand Up @@ -98,8 +94,7 @@ runCommand _opts = do
reloadFile _ = do
mentryPoint <- State.gets (fmap (^. replContextEntryPoint) . (^. replStateContext))
case mentryPoint of
Just entryPoint -> do
loadEntryPoint entryPoint
Just entryPoint -> loadEntryPoint entryPoint
Nothing -> liftIO . putStrLn $ pack noFileLoadedMsg

pSomeFile :: String -> SomeBase File
Expand Down
12 changes: 11 additions & 1 deletion src/Juvix/Compiler/Backend/Geb.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
module Juvix.Compiler.Backend.Geb (module Juvix.Compiler.Backend.Geb.Language, module Juvix.Compiler.Backend.Geb.Translation) where
module Juvix.Compiler.Backend.Geb
( module Juvix.Compiler.Backend.Geb.Language,
module Juvix.Compiler.Backend.Geb.Translation,
module Juvix.Compiler.Backend.Geb.Evaluator,
module Juvix.Compiler.Backend.Geb.Pretty,
module Juvix.Compiler.Backend.Geb.Translation.FromSource.Analysis.Inference,
)
where

import Juvix.Compiler.Backend.Geb.Evaluator
import Juvix.Compiler.Backend.Geb.Language
import Juvix.Compiler.Backend.Geb.Pretty hiding (group, list)
import Juvix.Compiler.Backend.Geb.Translation
import Juvix.Compiler.Backend.Geb.Translation.FromSource.Analysis.Inference
2 changes: 1 addition & 1 deletion src/Juvix/Compiler/Backend/Geb/Data/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ where

import Juvix.Compiler.Core.Data.BinderList

type Context a = BinderList a
type Context a = BinderList a
4 changes: 3 additions & 1 deletion src/Juvix/Compiler/Backend/Geb/Translation.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module Juvix.Compiler.Backend.Geb.Translation
( module Juvix.Compiler.Backend.Geb.Translation,
module Juvix.Compiler.Backend.Geb.Translation.FromCore,
module Juvix.Compiler.Backend.Geb.Translation.FromSource,
)
where

import Juvix.Compiler.Backend.Geb.Language
import Juvix.Compiler.Backend.Geb.Pretty
import Juvix.Compiler.Backend.Geb.Translation.FromCore
import Juvix.Compiler.Backend.Geb.Translation.FromCore hiding (Env)
import Juvix.Compiler.Backend.Geb.Translation.FromSource

newtype Result = Result
{ _resultCode :: Text
Expand Down
10 changes: 10 additions & 0 deletions src/Juvix/Compiler/Backend/Geb/Translation/FromSource.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ import Juvix.Parser.Error
import Juvix.Prelude
import Text.Megaparsec qualified as P

fromSource ::
Member (Error ParserError) r =>
Path Abs File ->
Text ->
Sem r Geb.Expression
fromSource fileName input =
case runParser fileName input of
Left err -> throw err
Right gebTerm -> pure gebTerm

runParser ::
Path Abs File ->
Text ->
Expand Down

0 comments on commit 016cadd

Please sign in to comment.