Skip to content

Commit

Permalink
[WIP] Start decoupling macro expansion from Haskell (and co.)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrosso committed Dec 1, 2019
1 parent d403858 commit 457bf34
Show file tree
Hide file tree
Showing 3 changed files with 267 additions and 135 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
11/17/2019
- [WIP] Continued work from last week. While wiring everything up, Polysemy became very, very unhappy. I spent some time trying to figure out what I was doing wrong, but with no luck. Eventually, I ended up removing `Sem.Reader (Backend backendEffs)` altogether in favor of just passing `Backend backendEffs` around as a parameter. I've since been running into what I think is a variation of https://github.com/polysemy-research/polysemy/issues/280 (which I opened yesterday after finding an MVCE).
I'm not too great with typeclass-fu, so this is taking a bit longer than I had anticipated (unfortunately).

11/10/2019
- [WIP] Break out Haskell-specific code in `Axel.Macros` into a `Backend` interface. Adapt `Axel.File` to use this new system.
24 changes: 16 additions & 8 deletions src/Axel/Haskell/File.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ import qualified Axel.Eff.Process as Effs (Process)
import qualified Axel.Eff.Resource as Effs (Resource)
import qualified Axel.Eff.Restartable as Effs (Restartable)
import Axel.Haskell.Convert (convertFile)
import Axel.Macros (handleFunctionApplication, processProgram)
import Axel.Macros
( HaskellBackendEffs
, handleFunctionApplication
, haskellBackend
, processProgram
)
import Axel.Normalize (normalizeStatement, withExprCtxt)
import Axel.Parse (parseMultiple', parseSource)
import Axel.Parse.AST (Expression(Symbol))
Expand Down Expand Up @@ -103,13 +108,16 @@ transpileSource ::
-> Sem.Sem effs SM.Output
transpileSource filePath source =
toHaskell . statementsToProgram <$>
(parseSource (Just filePath) source >>=
processProgram
@fileExpanderEffs
@funAppExpanderEffs
handleFunctionApplication
(void . transpileFileInPlace)
filePath)
Sem.runReader
haskellBackend
(parseSource (Just filePath) source >>=
processProgram
@fileExpanderEffs
@funAppExpanderEffs
@HaskellBackendEffs
handleFunctionApplication
(void . transpileFileInPlace)
filePath)

convertFileInPlace ::
(Sem.Members '[ Effs.Console, Effs.FileSystem, Sem.Error Error, Effs.FileSystem] effs)
Expand Down
Loading

0 comments on commit 457bf34

Please sign in to comment.