Skip to content

Commit

Permalink
IT WORKS!!!!
Browse files Browse the repository at this point in the history
First version that seems to build everything without a hitch!
  • Loading branch information
changlinli committed Nov 27, 2023
1 parent 85d5118 commit ddb16c2
Show file tree
Hide file tree
Showing 14 changed files with 295 additions and 413 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Zelm

This is a conservative fork of the Elm compiler. It aims to preserve complete
backwards compatibility and (nearly) complete forwards comptability with the
mainline Elm compiler as of Elm 0.19.1.

We say "nearly" because there are certain bugs in the Elm compiler that will be
fixed by the Zelm compiler. In particular some code which compiles successfully
using the Zelm compiler may cause the mainline Elm compiler to crash.

Zelm's main purpose is to provide a method for bug fixes and patches

For a more in-depth look at

**The following is the README for the original Elm compiler:**

# Elm

A delightful language for reliable webapps.
Expand Down
16 changes: 10 additions & 6 deletions REASONING.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ As such Zelm hopes to
**These are hopes not commitments.** But I do consider them valid barometers of
whether Zelm has a project has succeeded.


Because Zelm does not intend (at least not until 2025) to do feature
development on the Elm language itself, Zelm makes a different set of social
trade-offs compared to Elm itself.
Expand All @@ -287,13 +286,18 @@ and no changes to any APIs.
**Much like the technical goals, the social goals of Zelm are very tightly
scoped to this goal of responsiveness**.

I hope that by intentionally side-stepping questions of
To achieve this goal of timeliness, Zelm makes two trade-offs that are very
different from Elm itself.

1. We intentionally are side-stepping many fundamental design questions around
the language itself, at least until 2025.
2. We intend to lead by committee rather than individual.

Zelm prefers to lead by committee rather than individual.
The first point hopefully will allow us

We hope to have a stable roster of at least five people managing `zelm` and
`zelm-explorations`, maybe more (although for tie-breaking purposes I'd like to
keep the number odd).
In particular, our eventual goal is to have a stable roster of at least five
people managing `zelm` and `zelm-explorations`, maybe more (although for
tie-breaking purposes I'd like to keep the number odd).

# FAQ

Expand Down
9 changes: 5 additions & 4 deletions builder/src/Deps/Solver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,15 @@ constraintsDecoder =


data Env =
Env Stuff.PackageCache Http.Manager Connection Registry.ZelmRegistries
Env Stuff.PackageCache Http.Manager Connection Registry.ZelmRegistries Stuff.PackageOverridesCache


initEnv :: IO (Either Exit.RegistryProblem Env)
initEnv =
do mvar <- newEmptyMVar
_ <- forkIO $ putMVar mvar =<< Http.getManager
cache <- Stuff.getPackageCache
packageOverridesCache <- Stuff.getPackageOverridesCache
zelmCache <- Stuff.getZelmCache
customRepositoriesConfigLocation <- Stuff.getOrCreateZelmCustomRepositoryConfig
customRepositoriesDataOrErr <- loadCustomRepositoriesData customRepositoriesConfigLocation
Expand All @@ -413,7 +414,7 @@ initEnv =
do eitherRegistry <- Registry.fetch manager zelmCache customRepositoriesData
case eitherRegistry of
Right latestRegistry ->
return $ Right $ Env cache manager (Online manager) latestRegistry
return $ Right $ Env cache manager (Online manager) latestRegistry packageOverridesCache

Left problem ->
return $ Left $ problem
Expand All @@ -422,10 +423,10 @@ initEnv =
do eitherRegistry <- Registry.update manager zelmCache cachedRegistry
case eitherRegistry of
Right latestRegistry ->
return $ Right $ Env cache manager (Online manager) latestRegistry
return $ Right $ Env cache manager (Online manager) latestRegistry packageOverridesCache

Left _ ->
return $ Right $ Env cache manager Offline cachedRegistry
return $ Right $ Env cache manager Offline cachedRegistry packageOverridesCache



Expand Down
292 changes: 215 additions & 77 deletions builder/src/Elm/Details.hs

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion builder/src/File.hs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,11 @@ encodingError path ioErr =
writeBuilder :: FilePath -> B.Builder -> IO ()
writeBuilder path builder =
IO.withBinaryFile path IO.WriteMode $ \handle ->
do IO.hSetBuffering handle (IO.BlockBuffering Nothing)
do print "writeBuilder 1"
IO.hSetBuffering handle (IO.BlockBuffering Nothing)
print "writeBuilder 2"
B.hPutBuilder handle builder
print "writeBuilder 3"



Expand Down
17 changes: 17 additions & 0 deletions builder/src/Stuff.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ module Stuff
, withRegistryLock
, PackageCache
, ZelmSpecificCache
, PackageOverridesCache
, getPackageCache
, getZelmCache
, getPackageOverridesCache
, registry
, package
, packageOverride
, getReplCache
, getElmHome
, getOrCreateZelmCustomRepositoryConfig
Expand Down Expand Up @@ -163,12 +166,21 @@ newtype PackageCache = PackageCache FilePath

newtype ZelmSpecificCache = ZelmSpecificCache FilePath

newtype PackageOverridesCache = PackageOverridesCache FilePath


getPackageCache :: IO PackageCache
getPackageCache =
PackageCache <$> getCacheDir "packages"


getPackageOverridesCache :: IO PackageOverridesCache
getPackageOverridesCache =
do
(ZelmSpecificCache zelmSpecificCache) <- getZelmCache
pure $ PackageOverridesCache zelmSpecificCache


getZelmCache :: IO ZelmSpecificCache
getZelmCache =
ZelmSpecificCache <$> getOrCreateZelmCacheDir
Expand All @@ -184,6 +196,11 @@ package (PackageCache dir) name version =
dir </> Pkg.toFilePath name </> V.toChars version


packageOverride :: PackageOverridesCache -> Pkg.Name -> V.Version -> Pkg.Name -> V.Version -> FilePath
packageOverride (PackageOverridesCache dir) originalPkgName originalPkgVersion overridingPkgName overridingPkgVersion =
dir </> Pkg.toFilePath originalPkgName </> V.toChars originalPkgVersion </> Pkg.toFilePath overridingPkgName </> V.toChars overridingPkgVersion



-- CACHE

Expand Down
178 changes: 0 additions & 178 deletions cabal.project.freeze.ghc92

This file was deleted.

Loading

0 comments on commit ddb16c2

Please sign in to comment.