Skip to content

Commit

Permalink
use theory names without dots
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed May 8, 2024
1 parent 96db9ca commit e0b0666
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/Commands/Isabelle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Commands.Isabelle where
import Commands.Base
import Commands.Isabelle.Options
import Juvix.Compiler.Backend.Isabelle.Data.Result
import Juvix.Compiler.Backend.Isabelle.Language
import Juvix.Compiler.Backend.Isabelle.Pretty

runCommand ::
Expand All @@ -23,7 +24,7 @@ runCommand opts = do
let file :: Path Rel File
file =
relFile
( unpack (res ^. resultModuleId . moduleIdPath)
( unpack (thy ^. theoryName . namePretty)
<.> isabelleFileExt
)
absPath :: Path Abs File
Expand Down
8 changes: 7 additions & 1 deletion src/Juvix/Compiler/Backend/Isabelle/Translation/FromTyped.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Juvix.Compiler.Backend.Isabelle.Translation.FromTyped where

import Data.HashMap.Strict qualified as HashMap
import Data.Text qualified as T
import Juvix.Compiler.Backend.Isabelle.Data.Result
import Juvix.Compiler.Backend.Isabelle.Language
import Juvix.Compiler.Internal.Data.InfoTable qualified as Internal
Expand Down Expand Up @@ -39,11 +40,16 @@ fromInternal Internal.InternalTypedResult {..} = do
goModule :: Bool -> Internal.InfoTable -> Internal.Module -> Theory
goModule onlyTypes infoTable Internal.Module {..} =
Theory
{ _theoryName = _moduleName,
{ _theoryName = over nameText toIsabelleName $ over namePretty toIsabelleName _moduleName,
_theoryImports = map (^. Internal.importModuleName) (_moduleBody ^. Internal.moduleImports),
_theoryStatements = concatMap goMutualBlock (_moduleBody ^. Internal.moduleStatements)
}
where
toIsabelleName :: Text -> Text
toIsabelleName name = case reverse $ filter (/= "") $ T.splitOn "." name of
h : _ -> h
[] -> impossible

isTypeDef :: Statement -> Bool
isTypeDef = \case
StmtDefinition {} -> False
Expand Down

0 comments on commit e0b0666

Please sign in to comment.