mirror of
https://github.com/gren-lang/compiler.git
synced 2024-09-11 08:45:42 +03:00
First pass at renaming all elmy things in code.
This commit is contained in:
parent
bf126f728d
commit
ef89b431b8
@ -37,13 +37,13 @@ import qualified Data.NonEmptyList as NE
|
|||||||
import qualified Data.OneOrMore as OneOrMore
|
import qualified Data.OneOrMore as OneOrMore
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Details as Details
|
|
||||||
import qualified Elm.Docs as Docs
|
|
||||||
import qualified Elm.Interface as I
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Elm.Outline as Outline
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified File
|
import qualified File
|
||||||
|
import qualified Gren.Details as Details
|
||||||
|
import qualified Gren.Docs as Docs
|
||||||
|
import qualified Gren.Interface as I
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
import qualified Gren.Outline as Outline
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
||||||
import qualified Parse.Module as Parse
|
import qualified Parse.Module as Parse
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
@ -240,7 +240,7 @@ crawlDeps env mvar deps blockedValue =
|
|||||||
crawlModule :: Env -> MVar StatusDict -> DocsNeed -> ModuleName.Raw -> IO Status
|
crawlModule :: Env -> MVar StatusDict -> DocsNeed -> ModuleName.Raw -> IO Status
|
||||||
crawlModule env@(Env _ root projectType srcDirs buildID locals foreigns) mvar docsNeed name =
|
crawlModule env@(Env _ root projectType srcDirs buildID locals foreigns) mvar docsNeed name =
|
||||||
do
|
do
|
||||||
let fileName = ModuleName.toFilePath name <.> "elm"
|
let fileName = ModuleName.toFilePath name <.> "gren"
|
||||||
|
|
||||||
paths <- filterM File.exists (map (`addRelative` fileName) srcDirs)
|
paths <- filterM File.exists (map (`addRelative` fileName) srcDirs)
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ loadInterface root (name, ciMvar) =
|
|||||||
return (Just (name, iface))
|
return (Just (name, iface))
|
||||||
Unneeded ->
|
Unneeded ->
|
||||||
do
|
do
|
||||||
maybeIface <- File.readBinary (Dirs.elmi root name)
|
maybeIface <- File.readBinary (Dirs.greni root name)
|
||||||
case maybeIface of
|
case maybeIface of
|
||||||
Nothing ->
|
Nothing ->
|
||||||
do
|
do
|
||||||
@ -626,9 +626,9 @@ compile (Env key root projectType _ buildID _ _) docsNeed (Details.Local path ti
|
|||||||
do
|
do
|
||||||
let name = Src.getName modul
|
let name = Src.getName modul
|
||||||
let iface = I.fromModule pkg canonical annotations
|
let iface = I.fromModule pkg canonical annotations
|
||||||
let elmi = Dirs.elmi root name
|
let greni = Dirs.greni root name
|
||||||
File.writeBinary (Dirs.elmo root name) objects
|
File.writeBinary (Dirs.greno root name) objects
|
||||||
maybeOldi <- File.readBinary elmi
|
maybeOldi <- File.readBinary greni
|
||||||
case maybeOldi of
|
case maybeOldi of
|
||||||
Just oldi | oldi == iface ->
|
Just oldi | oldi == iface ->
|
||||||
do
|
do
|
||||||
@ -639,7 +639,7 @@ compile (Env key root projectType _ buildID _ _) docsNeed (Details.Local path ti
|
|||||||
_ ->
|
_ ->
|
||||||
do
|
do
|
||||||
-- iface may be lazy still
|
-- iface may be lazy still
|
||||||
File.writeBinary elmi iface
|
File.writeBinary greni iface
|
||||||
Reporting.report key Reporting.BDone
|
Reporting.report key Reporting.BDone
|
||||||
let local = Details.Local path time deps main buildID buildID
|
let local = Details.Local path time deps main buildID buildID
|
||||||
return (RNew local iface objects docs)
|
return (RNew local iface objects docs)
|
||||||
@ -885,7 +885,7 @@ getRootInfoHelp :: Env -> FilePath -> FilePath -> IO (Either Exit.BuildProjectPr
|
|||||||
getRootInfoHelp (Env _ _ _ srcDirs _ _ _) path absolutePath =
|
getRootInfoHelp (Env _ _ _ srcDirs _ _ _) path absolutePath =
|
||||||
let (dirs, file) = FP.splitFileName absolutePath
|
let (dirs, file) = FP.splitFileName absolutePath
|
||||||
(final, ext) = FP.splitExtension file
|
(final, ext) = FP.splitExtension file
|
||||||
in if ext /= ".elm"
|
in if ext /= ".gren"
|
||||||
then return $ Left $ Exit.BP_WithBadExtension path
|
then return $ Left $ Exit.BP_WithBadExtension path
|
||||||
else
|
else
|
||||||
let absoluteSegments = FP.splitDirectories dirs ++ [final]
|
let absoluteSegments = FP.splitDirectories dirs ++ [final]
|
||||||
@ -899,8 +899,8 @@ getRootInfoHelp (Env _ _ _ srcDirs _ _ _) path absolutePath =
|
|||||||
case matchingDirs of
|
case matchingDirs of
|
||||||
d1 : d2 : _ ->
|
d1 : d2 : _ ->
|
||||||
do
|
do
|
||||||
let p1 = addRelative d1 (FP.joinPath names <.> "elm")
|
let p1 = addRelative d1 (FP.joinPath names <.> "gren")
|
||||||
let p2 = addRelative d2 (FP.joinPath names <.> "elm")
|
let p2 = addRelative d2 (FP.joinPath names <.> "gren")
|
||||||
return $ Left $ Exit.BP_RootNameDuplicate name p1 p2
|
return $ Left $ Exit.BP_RootNameDuplicate name p1 p2
|
||||||
_ ->
|
_ ->
|
||||||
return $ Right $ RootInfo absolutePath path (LInside name)
|
return $ Right $ RootInfo absolutePath path (LInside name)
|
||||||
@ -911,7 +911,7 @@ getRootInfoHelp (Env _ _ _ srcDirs _ _ _) path absolutePath =
|
|||||||
|
|
||||||
isInsideSrcDirByName :: [String] -> AbsoluteSrcDir -> IO Bool
|
isInsideSrcDirByName :: [String] -> AbsoluteSrcDir -> IO Bool
|
||||||
isInsideSrcDirByName names srcDir =
|
isInsideSrcDirByName names srcDir =
|
||||||
File.exists (addRelative srcDir (FP.joinPath names <.> "elm"))
|
File.exists (addRelative srcDir (FP.joinPath names <.> "gren"))
|
||||||
|
|
||||||
isInsideSrcDirByPath :: [String] -> AbsoluteSrcDir -> Maybe (FilePath, Either [String] [String])
|
isInsideSrcDirByPath :: [String] -> AbsoluteSrcDir -> Maybe (FilePath, Either [String] [String])
|
||||||
isInsideSrcDirByPath segments (AbsoluteSrcDir srcDir) =
|
isInsideSrcDirByPath segments (AbsoluteSrcDir srcDir) =
|
||||||
|
@ -23,15 +23,15 @@ import qualified Data.NonEmptyList as NE
|
|||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Deps.Package as Package
|
import qualified Deps.Package as Package
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Compiler.Type as Type
|
|
||||||
import qualified Elm.Details as Details
|
|
||||||
import qualified Elm.Docs as Docs
|
|
||||||
import qualified Elm.Magnitude as M
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Elm.Outline as Outline
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified Elm.Version as V
|
|
||||||
import qualified File
|
import qualified File
|
||||||
|
import qualified Gren.Compiler.Type as Type
|
||||||
|
import qualified Gren.Details as Details
|
||||||
|
import qualified Gren.Docs as Docs
|
||||||
|
import qualified Gren.Magnitude as M
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
import qualified Gren.Outline as Outline
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified Json.Decode as D
|
import qualified Json.Decode as D
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
import qualified Reporting.Exit as Exit
|
import qualified Reporting.Exit as Exit
|
||||||
|
@ -7,10 +7,10 @@ where
|
|||||||
|
|
||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Magnitude as M
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified Elm.Version as V
|
|
||||||
import qualified Git
|
import qualified Git
|
||||||
|
import qualified Gren.Magnitude as M
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified System.Directory as Dir
|
import qualified System.Directory as Dir
|
||||||
|
|
||||||
-- GET VERSIONS
|
-- GET VERSIONS
|
||||||
|
@ -21,11 +21,11 @@ import Data.Map ((!))
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Deps.Package as Package
|
import qualified Deps.Package as Package
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Constraint as C
|
|
||||||
import qualified Elm.Outline as Outline
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified Elm.Version as V
|
|
||||||
import qualified File
|
import qualified File
|
||||||
|
import qualified Gren.Constraint as C
|
||||||
|
import qualified Gren.Outline as Outline
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified Json.Decode as D
|
import qualified Json.Decode as D
|
||||||
import qualified Reporting.Exit as Exit
|
import qualified Reporting.Exit as Exit
|
||||||
import System.FilePath ((</>))
|
import System.FilePath ((</>))
|
||||||
@ -48,7 +48,7 @@ data State = State
|
|||||||
}
|
}
|
||||||
|
|
||||||
data Constraints = Constraints
|
data Constraints = Constraints
|
||||||
{ _elm :: C.Constraint,
|
{ _gren :: C.Constraint,
|
||||||
_deps :: Map.Map Pkg.Name C.Constraint
|
_deps :: Map.Map Pkg.Name C.Constraint
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ data Result a
|
|||||||
| NoOfflineSolution
|
| NoOfflineSolution
|
||||||
| Err Exit.Solver
|
| Err Exit.Solver
|
||||||
|
|
||||||
-- VERIFY -- used by Elm.Details
|
-- VERIFY -- used by Gren.Details
|
||||||
|
|
||||||
data Details
|
data Details
|
||||||
= Details V.Version (Map.Map Pkg.Name C.Constraint)
|
= Details V.Version (Map.Map Pkg.Name C.Constraint)
|
||||||
@ -114,12 +114,12 @@ addToApp cache pkg outline@(Outline.AppOutline _ _ direct indirect testDirect te
|
|||||||
(\e -> return $ Err e)
|
(\e -> return $ Err e)
|
||||||
|
|
||||||
toApp :: State -> Pkg.Name -> Outline.AppOutline -> Map.Map Pkg.Name V.Version -> Map.Map Pkg.Name V.Version -> AppSolution
|
toApp :: State -> Pkg.Name -> Outline.AppOutline -> Map.Map Pkg.Name V.Version -> Map.Map Pkg.Name V.Version -> AppSolution
|
||||||
toApp (State _ constraints) pkg (Outline.AppOutline elm srcDirs direct _ testDirect _) old new =
|
toApp (State _ constraints) pkg (Outline.AppOutline gren srcDirs direct _ testDirect _) old new =
|
||||||
let d = Map.intersection new (Map.insert pkg V.one direct)
|
let d = Map.intersection new (Map.insert pkg V.one direct)
|
||||||
i = Map.difference (getTransitive constraints new (Map.toList d) Map.empty) d
|
i = Map.difference (getTransitive constraints new (Map.toList d) Map.empty) d
|
||||||
td = Map.intersection new (Map.delete pkg testDirect)
|
td = Map.intersection new (Map.delete pkg testDirect)
|
||||||
ti = Map.difference new (Map.unions [d, i, td])
|
ti = Map.difference new (Map.unions [d, i, td])
|
||||||
in AppSolution old new (Outline.AppOutline elm srcDirs d i td ti)
|
in AppSolution old new (Outline.AppOutline gren srcDirs d i td ti)
|
||||||
|
|
||||||
getTransitive :: Map.Map (Pkg.Name, V.Version) Constraints -> Map.Map Pkg.Name V.Version -> [(Pkg.Name, V.Version)] -> Map.Map Pkg.Name V.Version -> Map.Map Pkg.Name V.Version
|
getTransitive :: Map.Map (Pkg.Name, V.Version) Constraints -> Map.Map Pkg.Name V.Version -> [(Pkg.Name, V.Version)] -> Map.Map Pkg.Name V.Version -> Map.Map Pkg.Name V.Version
|
||||||
getTransitive constraints solution unvisited visited =
|
getTransitive constraints solution unvisited visited =
|
||||||
@ -165,8 +165,8 @@ exploreGoals (Goals pending solved) =
|
|||||||
addVersion :: Goals -> Pkg.Name -> V.Version -> Solver Goals
|
addVersion :: Goals -> Pkg.Name -> V.Version -> Solver Goals
|
||||||
addVersion (Goals pending solved) name version =
|
addVersion (Goals pending solved) name version =
|
||||||
do
|
do
|
||||||
(Constraints elm deps) <- getConstraints name version
|
(Constraints gren deps) <- getConstraints name version
|
||||||
if C.goodElm elm
|
if C.goodGren gren
|
||||||
then do
|
then do
|
||||||
newPending <- foldM (addConstraint solved) pending (Map.toList deps)
|
newPending <- foldM (addConstraint solved) pending (Map.toList deps)
|
||||||
return (Goals newPending (Map.insert name version solved))
|
return (Goals newPending (Map.insert name version solved))
|
||||||
@ -225,7 +225,7 @@ getConstraints pkg vsn =
|
|||||||
Left gitErr ->
|
Left gitErr ->
|
||||||
err $ Exit.SolverBadGitOperationVersionedPkg pkg vsn gitErr
|
err $ Exit.SolverBadGitOperationVersionedPkg pkg vsn gitErr
|
||||||
Right () -> do
|
Right () -> do
|
||||||
let path = home </> "elm.json"
|
let path = home </> "gren.json"
|
||||||
outlineExists <- File.exists path
|
outlineExists <- File.exists path
|
||||||
if outlineExists
|
if outlineExists
|
||||||
then do
|
then do
|
||||||
@ -242,8 +242,8 @@ constraintsDecoder =
|
|||||||
do
|
do
|
||||||
outline <- D.mapError (const ()) Outline.decoder
|
outline <- D.mapError (const ()) Outline.decoder
|
||||||
case outline of
|
case outline of
|
||||||
Outline.Pkg (Outline.PkgOutline _ _ _ _ _ deps _ elmConstraint) ->
|
Outline.Pkg (Outline.PkgOutline _ _ _ _ _ deps _ grenConstraint) ->
|
||||||
return (Constraints elmConstraint deps)
|
return (Constraints grenConstraint deps)
|
||||||
Outline.App _ ->
|
Outline.App _ ->
|
||||||
D.failure ()
|
D.failure ()
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ module Directories
|
|||||||
interfaces,
|
interfaces,
|
||||||
objects,
|
objects,
|
||||||
prepublishDir,
|
prepublishDir,
|
||||||
elmi,
|
greni,
|
||||||
elmo,
|
greno,
|
||||||
temp,
|
temp,
|
||||||
findRoot,
|
findRoot,
|
||||||
withRootLock,
|
withRootLock,
|
||||||
@ -20,9 +20,9 @@ module Directories
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified System.Directory as Dir
|
import qualified System.Directory as Dir
|
||||||
import qualified System.Environment as Env
|
import qualified System.Environment as Env
|
||||||
import qualified System.FileLock as Lock
|
import qualified System.FileLock as Lock
|
||||||
@ -55,15 +55,15 @@ compilerVersion :: FilePath
|
|||||||
compilerVersion =
|
compilerVersion =
|
||||||
V.toChars V.compiler
|
V.toChars V.compiler
|
||||||
|
|
||||||
-- ELMI and ELMO
|
-- GRENI and GRENO
|
||||||
|
|
||||||
elmi :: FilePath -> ModuleName.Raw -> FilePath
|
greni :: FilePath -> ModuleName.Raw -> FilePath
|
||||||
elmi root name =
|
greni root name =
|
||||||
toArtifactPath root name "elmi"
|
toArtifactPath root name "greni"
|
||||||
|
|
||||||
elmo :: FilePath -> ModuleName.Raw -> FilePath
|
greno :: FilePath -> ModuleName.Raw -> FilePath
|
||||||
elmo root name =
|
greno root name =
|
||||||
toArtifactPath root name "elmo"
|
toArtifactPath root name "greno"
|
||||||
|
|
||||||
toArtifactPath :: FilePath -> ModuleName.Raw -> String -> FilePath
|
toArtifactPath :: FilePath -> ModuleName.Raw -> String -> FilePath
|
||||||
toArtifactPath root name ext =
|
toArtifactPath root name ext =
|
||||||
@ -90,7 +90,7 @@ findRootHelp dirs =
|
|||||||
return Nothing
|
return Nothing
|
||||||
_ : _ ->
|
_ : _ ->
|
||||||
do
|
do
|
||||||
exists <- Dir.doesFileExist (FP.joinPath dirs </> "elm.json")
|
exists <- Dir.doesFileExist (FP.joinPath dirs </> "gren.json")
|
||||||
if exists
|
if exists
|
||||||
then return (Just (FP.joinPath dirs))
|
then return (Just (FP.joinPath dirs))
|
||||||
else findRootHelp (init dirs)
|
else findRootHelp (init dirs)
|
||||||
|
@ -19,14 +19,14 @@ import qualified Data.Maybe as Maybe
|
|||||||
import qualified Data.Name as N
|
import qualified Data.Name as N
|
||||||
import qualified Data.NonEmptyList as NE
|
import qualified Data.NonEmptyList as NE
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Compiler.Type.Extract as Extract
|
|
||||||
import qualified Elm.Details as Details
|
|
||||||
import qualified Elm.Interface as I
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified File
|
import qualified File
|
||||||
import qualified Generate.JavaScript as JS
|
import qualified Generate.JavaScript as JS
|
||||||
import qualified Generate.Mode as Mode
|
import qualified Generate.Mode as Mode
|
||||||
|
import qualified Gren.Compiler.Type.Extract as Extract
|
||||||
|
import qualified Gren.Details as Details
|
||||||
|
import qualified Gren.Interface as I
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Nitpick.Debug as Nitpick
|
import qualified Nitpick.Debug as Nitpick
|
||||||
import qualified Reporting.Exit as Exit
|
import qualified Reporting.Exit as Exit
|
||||||
import qualified Reporting.Task as Task
|
import qualified Reporting.Task as Task
|
||||||
@ -125,7 +125,7 @@ loadObject root modul =
|
|||||||
Build.Cached name _ _ ->
|
Build.Cached name _ _ ->
|
||||||
do
|
do
|
||||||
mvar <- newEmptyMVar
|
mvar <- newEmptyMVar
|
||||||
_ <- forkIO $ putMVar mvar =<< File.readBinary (Dirs.elmo root name)
|
_ <- forkIO $ putMVar mvar =<< File.readBinary (Dirs.greno root name)
|
||||||
return (name, mvar)
|
return (name, mvar)
|
||||||
|
|
||||||
-- FINALIZE OBJECTS
|
-- FINALIZE OBJECTS
|
||||||
@ -176,7 +176,7 @@ loadTypesHelp root modul =
|
|||||||
mvar <- newEmptyMVar
|
mvar <- newEmptyMVar
|
||||||
_ <- forkIO $
|
_ <- forkIO $
|
||||||
do
|
do
|
||||||
maybeIface <- File.readBinary (Dirs.elmi root name)
|
maybeIface <- File.readBinary (Dirs.greni root name)
|
||||||
putMVar mvar (Extract.fromInterface name <$> maybeIface)
|
putMVar mvar (Extract.fromInterface name <$> maybeIface)
|
||||||
return mvar
|
return mvar
|
||||||
Build.Loaded iface ->
|
Build.Loaded iface ->
|
||||||
|
@ -16,8 +16,8 @@ where
|
|||||||
import qualified Data.ByteString.Char8 as BS
|
import qualified Data.ByteString.Char8 as BS
|
||||||
import qualified Data.Either as Either
|
import qualified Data.Either as Either
|
||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Parse.Primitives as Parser
|
import qualified Parse.Primitives as Parser
|
||||||
import System.Directory (findExecutable)
|
import System.Directory (findExecutable)
|
||||||
import qualified System.Exit as Exit
|
import qualified System.Exit as Exit
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Details
|
module Gren.Details
|
||||||
( Details (..),
|
( Details (..),
|
||||||
BuildID,
|
BuildID,
|
||||||
ValidOutline (..),
|
ValidOutline (..),
|
||||||
@ -35,15 +35,15 @@ import qualified Data.Set as Set
|
|||||||
import Data.Word (Word64)
|
import Data.Word (Word64)
|
||||||
import qualified Deps.Solver as Solver
|
import qualified Deps.Solver as Solver
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Constraint as Con
|
|
||||||
import qualified Elm.Docs as Docs
|
|
||||||
import qualified Elm.Interface as I
|
|
||||||
import qualified Elm.Kernel as Kernel
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Elm.Outline as Outline
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified Elm.Version as V
|
|
||||||
import qualified File
|
import qualified File
|
||||||
|
import qualified Gren.Constraint as Con
|
||||||
|
import qualified Gren.Docs as Docs
|
||||||
|
import qualified Gren.Interface as I
|
||||||
|
import qualified Gren.Kernel as Kernel
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
import qualified Gren.Outline as Outline
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
||||||
import qualified Parse.Module as Parse
|
import qualified Parse.Module as Parse
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
@ -120,7 +120,7 @@ loadInterfaces root (Details _ _ _ _ _ extras) =
|
|||||||
verifyInstall :: BW.Scope -> FilePath -> Solver.Env -> Outline.Outline -> IO (Either Exit.Details ())
|
verifyInstall :: BW.Scope -> FilePath -> Solver.Env -> Outline.Outline -> IO (Either Exit.Details ())
|
||||||
verifyInstall scope root (Solver.Env cache) outline =
|
verifyInstall scope root (Solver.Env cache) outline =
|
||||||
do
|
do
|
||||||
time <- File.getTime (root </> "elm.json")
|
time <- File.getTime (root </> "gren.json")
|
||||||
let key = Reporting.ignorer
|
let key = Reporting.ignorer
|
||||||
let env = Env key scope root cache
|
let env = Env key scope root cache
|
||||||
case outline of
|
case outline of
|
||||||
@ -132,7 +132,7 @@ verifyInstall scope root (Solver.Env cache) outline =
|
|||||||
load :: Reporting.Style -> BW.Scope -> FilePath -> IO (Either Exit.Details Details)
|
load :: Reporting.Style -> BW.Scope -> FilePath -> IO (Either Exit.Details Details)
|
||||||
load style scope root =
|
load style scope root =
|
||||||
do
|
do
|
||||||
newTime <- File.getTime (root </> "elm.json")
|
newTime <- File.getTime (root </> "gren.json")
|
||||||
maybeDetails <- File.readBinary (Dirs.details root)
|
maybeDetails <- File.readBinary (Dirs.details root)
|
||||||
case maybeDetails of
|
case maybeDetails of
|
||||||
Nothing ->
|
Nothing ->
|
||||||
@ -184,25 +184,25 @@ initEnv key scope root =
|
|||||||
type Task a = Task.Task Exit.Details a
|
type Task a = Task.Task Exit.Details a
|
||||||
|
|
||||||
verifyPkg :: Env -> File.Time -> Outline.PkgOutline -> Task Details
|
verifyPkg :: Env -> File.Time -> Outline.PkgOutline -> Task Details
|
||||||
verifyPkg env time (Outline.PkgOutline pkg _ _ _ exposed direct testDirect elm) =
|
verifyPkg env time (Outline.PkgOutline pkg _ _ _ exposed direct testDirect gren) =
|
||||||
if Con.goodElm elm
|
if Con.goodGren gren
|
||||||
then do
|
then do
|
||||||
solution <- verifyConstraints env =<< union noDups direct testDirect
|
solution <- verifyConstraints env =<< union noDups direct testDirect
|
||||||
let exposedList = Outline.flattenExposed exposed
|
let exposedList = Outline.flattenExposed exposed
|
||||||
let exactDeps = Map.map (\(Solver.Details v _) -> v) solution -- for pkg docs in reactor
|
let exactDeps = Map.map (\(Solver.Details v _) -> v) solution -- for pkg docs in reactor
|
||||||
verifyDependencies env time (ValidPkg pkg exposedList exactDeps) solution direct
|
verifyDependencies env time (ValidPkg pkg exposedList exactDeps) solution direct
|
||||||
else Task.throw $ Exit.DetailsBadElmInPkg elm
|
else Task.throw $ Exit.DetailsBadGrenInPkg gren
|
||||||
|
|
||||||
verifyApp :: Env -> File.Time -> Outline.AppOutline -> Task Details
|
verifyApp :: Env -> File.Time -> Outline.AppOutline -> Task Details
|
||||||
verifyApp env time outline@(Outline.AppOutline elmVersion srcDirs direct _ _ _) =
|
verifyApp env time outline@(Outline.AppOutline grenVersion srcDirs direct _ _ _) =
|
||||||
if elmVersion == V.compiler
|
if grenVersion == V.compiler
|
||||||
then do
|
then do
|
||||||
stated <- checkAppDeps outline
|
stated <- checkAppDeps outline
|
||||||
actual <- verifyConstraints env (Map.map Con.exactly stated)
|
actual <- verifyConstraints env (Map.map Con.exactly stated)
|
||||||
if Map.size stated == Map.size actual
|
if Map.size stated == Map.size actual
|
||||||
then verifyDependencies env time (ValidApp srcDirs) actual direct
|
then verifyDependencies env time (ValidApp srcDirs) actual direct
|
||||||
else Task.throw Exit.DetailsHandEditedDependencies
|
else Task.throw Exit.DetailsHandEditedDependencies
|
||||||
else Task.throw $ Exit.DetailsBadElmInAppOutline elmVersion
|
else Task.throw $ Exit.DetailsBadGrenInAppOutline grenVersion
|
||||||
|
|
||||||
checkAppDeps :: Outline.AppOutline -> Task (Map.Map Pkg.Name V.Version)
|
checkAppDeps :: Outline.AppOutline -> Task (Map.Map Pkg.Name V.Version)
|
||||||
checkAppDeps (Outline.AppOutline _ _ direct indirect testDirect testIndirect) =
|
checkAppDeps (Outline.AppOutline _ _ direct indirect testDirect testIndirect) =
|
||||||
@ -413,7 +413,7 @@ addLocalGraph name status graph =
|
|||||||
|
|
||||||
gatherInterfaces :: Map.Map ModuleName.Raw () -> Map.Map ModuleName.Raw Result -> Map.Map ModuleName.Raw I.DependencyInterface
|
gatherInterfaces :: Map.Map ModuleName.Raw () -> Map.Map ModuleName.Raw Result -> Map.Map ModuleName.Raw I.DependencyInterface
|
||||||
gatherInterfaces exposed artifacts =
|
gatherInterfaces exposed artifacts =
|
||||||
let onLeft = Map.mapMissing (error "compiler bug manifesting in Elm.Details.gatherInterfaces")
|
let onLeft = Map.mapMissing (error "compiler bug manifesting in Gren.Details.gatherInterfaces")
|
||||||
onRight = Map.mapMaybeMissing (\_ iface -> toLocalInterface I.private iface)
|
onRight = Map.mapMaybeMissing (\_ iface -> toLocalInterface I.private iface)
|
||||||
onBoth = Map.zipWithMaybeMatched (\_ () iface -> toLocalInterface I.public iface)
|
onBoth = Map.zipWithMaybeMatched (\_ () iface -> toLocalInterface I.public iface)
|
||||||
in Map.merge onLeft onRight onBoth exposed artifacts
|
in Map.merge onLeft onRight onBoth exposed artifacts
|
||||||
@ -467,7 +467,7 @@ data Status
|
|||||||
crawlModule :: Map.Map ModuleName.Raw ForeignInterface -> MVar StatusDict -> Pkg.Name -> FilePath -> DocsStatus -> ModuleName.Raw -> IO (Maybe Status)
|
crawlModule :: Map.Map ModuleName.Raw ForeignInterface -> MVar StatusDict -> Pkg.Name -> FilePath -> DocsStatus -> ModuleName.Raw -> IO (Maybe Status)
|
||||||
crawlModule foreignDeps mvar pkg src docsStatus name =
|
crawlModule foreignDeps mvar pkg src docsStatus name =
|
||||||
do
|
do
|
||||||
let path = src </> ModuleName.toFilePath name <.> "elm"
|
let path = src </> ModuleName.toFilePath name <.> "gren"
|
||||||
exists <- File.exists path
|
exists <- File.exists path
|
||||||
case Map.lookup name foreignDeps of
|
case Map.lookup name foreignDeps of
|
||||||
Just ForeignAmbiguous ->
|
Just ForeignAmbiguous ->
|
@ -2,7 +2,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Outline
|
module Gren.Outline
|
||||||
( Outline (..),
|
( Outline (..),
|
||||||
AppOutline (..),
|
AppOutline (..),
|
||||||
PkgOutline (..),
|
PkgOutline (..),
|
||||||
@ -22,13 +22,13 @@ import Data.Binary (Binary, get, getWord8, put, putWord8)
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.NonEmptyList as NE
|
import qualified Data.NonEmptyList as NE
|
||||||
import qualified Data.OneOrMore as OneOrMore
|
import qualified Data.OneOrMore as OneOrMore
|
||||||
import qualified Elm.Constraint as Con
|
|
||||||
import qualified Elm.Licenses as Licenses
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified Elm.Version as V
|
|
||||||
import qualified File
|
import qualified File
|
||||||
import Foreign.Ptr (minusPtr)
|
import Foreign.Ptr (minusPtr)
|
||||||
|
import qualified Gren.Constraint as Con
|
||||||
|
import qualified Gren.Licenses as Licenses
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified Json.Decode as D
|
import qualified Json.Decode as D
|
||||||
import Json.Encode ((==>))
|
import Json.Encode ((==>))
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
||||||
@ -47,7 +47,7 @@ data Outline
|
|||||||
| Pkg PkgOutline
|
| Pkg PkgOutline
|
||||||
|
|
||||||
data AppOutline = AppOutline
|
data AppOutline = AppOutline
|
||||||
{ _app_elm_version :: V.Version,
|
{ _app_gren_version :: V.Version,
|
||||||
_app_source_dirs :: NE.List SrcDir,
|
_app_source_dirs :: NE.List SrcDir,
|
||||||
_app_deps_direct :: Map.Map Pkg.Name V.Version,
|
_app_deps_direct :: Map.Map Pkg.Name V.Version,
|
||||||
_app_deps_indirect :: Map.Map Pkg.Name V.Version,
|
_app_deps_indirect :: Map.Map Pkg.Name V.Version,
|
||||||
@ -63,7 +63,7 @@ data PkgOutline = PkgOutline
|
|||||||
_pkg_exposed :: Exposed,
|
_pkg_exposed :: Exposed,
|
||||||
_pkg_deps :: Map.Map Pkg.Name Con.Constraint,
|
_pkg_deps :: Map.Map Pkg.Name Con.Constraint,
|
||||||
_pkg_test_deps :: Map.Map Pkg.Name Con.Constraint,
|
_pkg_test_deps :: Map.Map Pkg.Name Con.Constraint,
|
||||||
_pkg_elm_version :: Con.Constraint
|
_pkg_gren_version :: Con.Constraint
|
||||||
}
|
}
|
||||||
|
|
||||||
data Exposed
|
data Exposed
|
||||||
@ -94,18 +94,18 @@ flattenExposed exposed =
|
|||||||
|
|
||||||
write :: FilePath -> Outline -> IO ()
|
write :: FilePath -> Outline -> IO ()
|
||||||
write root outline =
|
write root outline =
|
||||||
E.write (root </> "elm.json") (encode outline)
|
E.write (root </> "gren.json") (encode outline)
|
||||||
|
|
||||||
-- JSON ENCODE
|
-- JSON ENCODE
|
||||||
|
|
||||||
encode :: Outline -> E.Value
|
encode :: Outline -> E.Value
|
||||||
encode outline =
|
encode outline =
|
||||||
case outline of
|
case outline of
|
||||||
App (AppOutline elm srcDirs depsDirect depsTrans testDirect testTrans) ->
|
App (AppOutline gren srcDirs depsDirect depsTrans testDirect testTrans) ->
|
||||||
E.object
|
E.object
|
||||||
[ "type" ==> E.chars "application",
|
[ "type" ==> E.chars "application",
|
||||||
"source-directories" ==> E.list encodeSrcDir (NE.toList srcDirs),
|
"source-directories" ==> E.list encodeSrcDir (NE.toList srcDirs),
|
||||||
"elm-version" ==> V.encode elm,
|
"gren-version" ==> V.encode gren,
|
||||||
"dependencies"
|
"dependencies"
|
||||||
==> E.object
|
==> E.object
|
||||||
[ "direct" ==> encodeDeps V.encode depsDirect,
|
[ "direct" ==> encodeDeps V.encode depsDirect,
|
||||||
@ -117,7 +117,7 @@ encode outline =
|
|||||||
"indirect" ==> encodeDeps V.encode testTrans
|
"indirect" ==> encodeDeps V.encode testTrans
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
Pkg (PkgOutline name summary license version exposed deps tests elm) ->
|
Pkg (PkgOutline name summary license version exposed deps tests gren) ->
|
||||||
E.object
|
E.object
|
||||||
[ "type" ==> E.string (Json.fromChars "package"),
|
[ "type" ==> E.string (Json.fromChars "package"),
|
||||||
"name" ==> Pkg.encode name,
|
"name" ==> Pkg.encode name,
|
||||||
@ -125,7 +125,7 @@ encode outline =
|
|||||||
"license" ==> Licenses.encode license,
|
"license" ==> Licenses.encode license,
|
||||||
"version" ==> V.encode version,
|
"version" ==> V.encode version,
|
||||||
"exposed-modules" ==> encodeExposed exposed,
|
"exposed-modules" ==> encodeExposed exposed,
|
||||||
"elm-version" ==> Con.encode elm,
|
"gren-version" ==> Con.encode gren,
|
||||||
"dependencies" ==> encodeDeps Con.encode deps,
|
"dependencies" ==> encodeDeps Con.encode deps,
|
||||||
"test-dependencies" ==> encodeDeps Con.encode tests
|
"test-dependencies" ==> encodeDeps Con.encode tests
|
||||||
]
|
]
|
||||||
@ -157,7 +157,7 @@ encodeSrcDir srcDir =
|
|||||||
read :: FilePath -> IO (Either Exit.Outline Outline)
|
read :: FilePath -> IO (Either Exit.Outline Outline)
|
||||||
read root =
|
read root =
|
||||||
do
|
do
|
||||||
bytes <- File.readUtf8 (root </> "elm.json")
|
bytes <- File.readUtf8 (root </> "gren.json")
|
||||||
case D.fromByteString decoder bytes of
|
case D.fromByteString decoder bytes of
|
||||||
Left err ->
|
Left err ->
|
||||||
return $ Left (Exit.OutlineHasBadStructure err)
|
return $ Left (Exit.OutlineHasBadStructure err)
|
||||||
@ -244,7 +244,7 @@ decoder =
|
|||||||
appDecoder :: Decoder AppOutline
|
appDecoder :: Decoder AppOutline
|
||||||
appDecoder =
|
appDecoder =
|
||||||
AppOutline
|
AppOutline
|
||||||
<$> D.field "elm-version" versionDecoder
|
<$> D.field "gren-version" versionDecoder
|
||||||
<*> D.field "source-directories" dirsDecoder
|
<*> D.field "source-directories" dirsDecoder
|
||||||
<*> D.field "dependencies" (D.field "direct" (depsDecoder versionDecoder))
|
<*> D.field "dependencies" (D.field "direct" (depsDecoder versionDecoder))
|
||||||
<*> D.field "dependencies" (D.field "indirect" (depsDecoder versionDecoder))
|
<*> D.field "dependencies" (D.field "indirect" (depsDecoder versionDecoder))
|
||||||
@ -261,7 +261,7 @@ pkgDecoder =
|
|||||||
<*> D.field "exposed-modules" exposedDecoder
|
<*> D.field "exposed-modules" exposedDecoder
|
||||||
<*> D.field "dependencies" (depsDecoder constraintDecoder)
|
<*> D.field "dependencies" (depsDecoder constraintDecoder)
|
||||||
<*> D.field "test-dependencies" (depsDecoder constraintDecoder)
|
<*> D.field "test-dependencies" (depsDecoder constraintDecoder)
|
||||||
<*> D.field "elm-version" constraintDecoder
|
<*> D.field "gren-version" constraintDecoder
|
||||||
|
|
||||||
-- JSON DECODE HELPERS
|
-- JSON DECODE HELPERS
|
||||||
|
|
@ -34,9 +34,9 @@ import Control.Exception (AsyncException (UserInterrupt), SomeException, catch,
|
|||||||
import Control.Monad (when)
|
import Control.Monad (when)
|
||||||
import qualified Data.ByteString.Builder as B
|
import qualified Data.ByteString.Builder as B
|
||||||
import qualified Data.NonEmptyList as NE
|
import qualified Data.NonEmptyList as NE
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Json.Encode as Encode
|
import qualified Json.Encode as Encode
|
||||||
import Reporting.Doc ((<+>))
|
import Reporting.Doc ((<+>))
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
@ -398,15 +398,15 @@ putException e = do
|
|||||||
D.vcat $ map (\line -> D.red ">" <> " " <> D.fromChars line) (lines (show e)),
|
D.vcat $ map (\line -> D.red ">" <> " " <> D.fromChars line) (lines (show e)),
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"These errors are usually pretty confusing, so start by asking around on one of\
|
"These errors are usually pretty confusing, so start by asking around on one of\
|
||||||
\ forums listed at https://elm-lang.org/community to see if anyone can get you\
|
\ forums listed at https://gren-lang.org/community to see if anyone can get you\
|
||||||
\ unstuck quickly.",
|
\ unstuck quickly.",
|
||||||
D.dullyellow "-- REQUEST ---------------------------------------------------------------------",
|
D.dullyellow "-- REQUEST ---------------------------------------------------------------------",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"If you are feeling up to it, please try to get your code down to the smallest\
|
"If you are feeling up to it, please try to get your code down to the smallest\
|
||||||
\ version that still triggers this message. Ideally in a single Main.elm and\
|
\ version that still triggers this message. Ideally in a single Main.gren and\
|
||||||
\ elm.json file.",
|
\ gren.json file.",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"From there open a NEW issue at https://github.com/elm/compiler/issues with\
|
"From there open a NEW issue at https://github.com/gren/compiler/issues with\
|
||||||
\ your reduced example pasted in directly. (Not a link to a repo or gist!) Do not\
|
\ your reduced example pasted in directly. (Not a link to a repo or gist!) Do not\
|
||||||
\ worry about if someone else saw something similar. More examples is better!",
|
\ worry about if someone else saw something similar. More examples is better!",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@ module AST.Canonical
|
|||||||
where
|
where
|
||||||
|
|
||||||
{- Creating a canonical AST means finding the home module for all variables.
|
{- Creating a canonical AST means finding the home module for all variables.
|
||||||
So if you have L.map, you need to figure out that it is from the elm/core
|
So if you have L.map, you need to figure out that it is from the core/core
|
||||||
package in the List module.
|
package in the List module.
|
||||||
|
|
||||||
In later phases (e.g. type inference, exhaustiveness checking, optimization)
|
In later phases (e.g. type inference, exhaustiveness checking, optimization)
|
||||||
@ -55,16 +55,15 @@ So it is clear why the data is kept around.
|
|||||||
|
|
||||||
import qualified AST.Source as Src
|
import qualified AST.Source as Src
|
||||||
import qualified AST.Utils.Binop as Binop
|
import qualified AST.Utils.Binop as Binop
|
||||||
import qualified AST.Utils.Shader as Shader
|
|
||||||
import Control.Monad (liftM, liftM2, liftM3, liftM4, replicateM)
|
import Control.Monad (liftM, liftM2, liftM3, liftM4, replicateM)
|
||||||
import Data.Binary
|
import Data.Binary
|
||||||
import qualified Data.Index as Index
|
import qualified Data.Index as Index
|
||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import Data.Name (Name)
|
import Data.Name (Name)
|
||||||
import qualified Elm.Float as EF
|
import qualified Gren.Float as EF
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.String as ES
|
import qualified Gren.String as ES
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
|
||||||
-- EXPRESSIONS
|
-- EXPRESSIONS
|
||||||
@ -101,7 +100,6 @@ data Expr_
|
|||||||
| Record (Map.Map Name Expr)
|
| Record (Map.Map Name Expr)
|
||||||
| Unit
|
| Unit
|
||||||
| Tuple Expr Expr (Maybe Expr)
|
| Tuple Expr Expr (Maybe Expr)
|
||||||
| Shader Shader.Source Shader.Types
|
|
||||||
|
|
||||||
data CaseBranch
|
data CaseBranch
|
||||||
= CaseBranch Pattern Expr
|
= CaseBranch Pattern Expr
|
||||||
|
@ -30,11 +30,11 @@ import qualified Data.Map as Map
|
|||||||
import Data.Name (Name)
|
import Data.Name (Name)
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.Float as EF
|
import qualified Gren.Float as EF
|
||||||
import qualified Elm.Kernel as K
|
import qualified Gren.Kernel as K
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.String as ES
|
import qualified Gren.String as ES
|
||||||
import qualified Optimize.DecisionTree as DT
|
import qualified Optimize.DecisionTree as DT
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
|
||||||
@ -175,9 +175,9 @@ addKernelDep :: K.Chunk -> Set.Set Global -> Set.Set Global
|
|||||||
addKernelDep chunk deps =
|
addKernelDep chunk deps =
|
||||||
case chunk of
|
case chunk of
|
||||||
K.JS _ -> deps
|
K.JS _ -> deps
|
||||||
K.ElmVar home name -> Set.insert (Global home name) deps
|
K.GrenVar home name -> Set.insert (Global home name) deps
|
||||||
K.JsVar shortName _ -> Set.insert (toKernelGlobal shortName) deps
|
K.JsVar shortName _ -> Set.insert (toKernelGlobal shortName) deps
|
||||||
K.ElmField _ -> deps
|
K.GrenField _ -> deps
|
||||||
K.JsField _ -> deps
|
K.JsField _ -> deps
|
||||||
K.JsEnum _ -> deps
|
K.JsEnum _ -> deps
|
||||||
K.Debug -> deps
|
K.Debug -> deps
|
||||||
|
@ -32,8 +32,8 @@ import qualified AST.Utils.Binop as Binop
|
|||||||
import qualified AST.Utils.Shader as Shader
|
import qualified AST.Utils.Shader as Shader
|
||||||
import Data.Name (Name)
|
import Data.Name (Name)
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.Float as EF
|
import qualified Gren.Float as EF
|
||||||
import qualified Elm.String as ES
|
import qualified Gren.String as ES
|
||||||
import qualified Parse.Primitives as P
|
import qualified Parse.Primitives as P
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import qualified Canonicalize.Type as Type
|
|||||||
import qualified Data.Foldable as F
|
import qualified Data.Foldable as F
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Canonicalize as Error
|
import qualified Reporting.Error.Canonicalize as Error
|
||||||
import qualified Reporting.Result as Result
|
import qualified Reporting.Result as Result
|
||||||
|
@ -27,7 +27,7 @@ import qualified Data.Map.Merge.Strict as Map
|
|||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.OneOrMore as OneOrMore
|
import qualified Data.OneOrMore as OneOrMore
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Canonicalize as Error
|
import qualified Reporting.Error.Canonicalize as Error
|
||||||
import qualified Reporting.Result as Result
|
import qualified Reporting.Result as Result
|
||||||
|
@ -15,9 +15,9 @@ import qualified Data.List as List
|
|||||||
import Data.Map.Strict ((!))
|
import Data.Map.Strict ((!))
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.Interface as I
|
import qualified Gren.Interface as I
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Canonicalize as Error
|
import qualified Reporting.Error.Canonicalize as Error
|
||||||
import qualified Reporting.Result as Result
|
import qualified Reporting.Result as Result
|
||||||
|
@ -17,7 +17,7 @@ import qualified Data.Index as Index
|
|||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Canonicalize as Error
|
import qualified Reporting.Error.Canonicalize as Error
|
||||||
import qualified Reporting.Result as Result
|
import qualified Reporting.Result as Result
|
||||||
|
@ -24,8 +24,8 @@ import qualified Data.Index as Index
|
|||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Canonicalize as Error
|
import qualified Reporting.Error.Canonicalize as Error
|
||||||
import qualified Reporting.Result as Result
|
import qualified Reporting.Result as Result
|
||||||
@ -127,8 +127,9 @@ canonicalize env (A.At region expression) =
|
|||||||
<$> canonicalize env a
|
<$> canonicalize env a
|
||||||
<*> canonicalize env b
|
<*> canonicalize env b
|
||||||
<*> canonicalizeTupleExtras region env cs
|
<*> canonicalizeTupleExtras region env cs
|
||||||
Src.Shader src tipe ->
|
Src.Shader _ _ ->
|
||||||
Result.ok (Can.Shader src tipe)
|
-- TODO: Remove shaders from language
|
||||||
|
Result.throw (Error.TupleLargerThanThree region)
|
||||||
|
|
||||||
-- CANONICALIZE TUPLE EXTRAS
|
-- CANONICALIZE TUPLE EXTRAS
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ import qualified Data.Graph as Graph
|
|||||||
import qualified Data.Index as Index
|
import qualified Data.Index as Index
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.Interface as I
|
import qualified Gren.Interface as I
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Canonicalize as Error
|
import qualified Reporting.Error.Canonicalize as Error
|
||||||
import qualified Reporting.Result as Result
|
import qualified Reporting.Result as Result
|
||||||
|
@ -16,7 +16,7 @@ import qualified Data.Index as Index
|
|||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Canonicalize as Error
|
import qualified Reporting.Error.Canonicalize as Error
|
||||||
import qualified Reporting.Result as Result
|
import qualified Reporting.Result as Result
|
||||||
|
@ -12,9 +12,9 @@ import qualified AST.Source as Src
|
|||||||
import qualified Canonicalize.Module as Canonicalize
|
import qualified Canonicalize.Module as Canonicalize
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.Interface as I
|
import qualified Gren.Interface as I
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Nitpick.PatternMatches as PatternMatches
|
import qualified Nitpick.PatternMatches as PatternMatches
|
||||||
import qualified Optimize.Module as Optimize
|
import qualified Optimize.Module as Optimize
|
||||||
import qualified Reporting.Error as E
|
import qualified Reporting.Error as E
|
||||||
|
@ -9,7 +9,7 @@ module Data.Name
|
|||||||
( Name,
|
( Name,
|
||||||
--
|
--
|
||||||
toChars,
|
toChars,
|
||||||
toElmString,
|
toGrenString,
|
||||||
toBuilder,
|
toBuilder,
|
||||||
--
|
--
|
||||||
fromPtr,
|
fromPtr,
|
||||||
@ -76,7 +76,6 @@ import qualified Data.Coerce as Coerce
|
|||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Data.String as Chars
|
import qualified Data.String as Chars
|
||||||
import qualified Data.Utf8 as Utf8
|
import qualified Data.Utf8 as Utf8
|
||||||
import qualified Elm.String as ES
|
|
||||||
import GHC.Exts
|
import GHC.Exts
|
||||||
( Int (I#),
|
( Int (I#),
|
||||||
Ptr,
|
Ptr,
|
||||||
@ -85,21 +84,22 @@ import GHC.Exts
|
|||||||
import GHC.Prim
|
import GHC.Prim
|
||||||
import GHC.ST (ST (ST), runST)
|
import GHC.ST (ST (ST), runST)
|
||||||
import GHC.Word (Word8 (W8#))
|
import GHC.Word (Word8 (W8#))
|
||||||
|
import qualified Gren.String as ES
|
||||||
import Prelude hiding (length, maybe, negate)
|
import Prelude hiding (length, maybe, negate)
|
||||||
|
|
||||||
-- NAME
|
-- NAME
|
||||||
|
|
||||||
type Name =
|
type Name =
|
||||||
Utf8.Utf8 ELM_NAME
|
Utf8.Utf8 GREN_NAME
|
||||||
|
|
||||||
data ELM_NAME
|
data GREN_NAME
|
||||||
|
|
||||||
-- INSTANCES
|
-- INSTANCES
|
||||||
|
|
||||||
instance Chars.IsString (Utf8.Utf8 ELM_NAME) where
|
instance Chars.IsString (Utf8.Utf8 GREN_NAME) where
|
||||||
fromString = Utf8.fromChars
|
fromString = Utf8.fromChars
|
||||||
|
|
||||||
instance Binary.Binary (Utf8.Utf8 ELM_NAME) where
|
instance Binary.Binary (Utf8.Utf8 GREN_NAME) where
|
||||||
get = Utf8.getUnder256
|
get = Utf8.getUnder256
|
||||||
put = Utf8.putUnder256
|
put = Utf8.putUnder256
|
||||||
|
|
||||||
@ -109,8 +109,8 @@ toChars :: Name -> [Char]
|
|||||||
toChars =
|
toChars =
|
||||||
Utf8.toChars
|
Utf8.toChars
|
||||||
|
|
||||||
toElmString :: Name -> ES.String
|
toGrenString :: Name -> ES.String
|
||||||
toElmString =
|
toGrenString =
|
||||||
Coerce.coerce
|
Coerce.coerce
|
||||||
|
|
||||||
{-# INLINE toBuilder #-}
|
{-# INLINE toBuilder #-}
|
||||||
@ -175,7 +175,7 @@ isCompappendType = Utf8.startsWith prefix_compappend
|
|||||||
|
|
||||||
{-# NOINLINE prefix_kernel #-}
|
{-# NOINLINE prefix_kernel #-}
|
||||||
prefix_kernel :: Name
|
prefix_kernel :: Name
|
||||||
prefix_kernel = fromChars "Elm.Kernel."
|
prefix_kernel = fromChars "Gren.Kernel."
|
||||||
|
|
||||||
{-# NOINLINE prefix_number #-}
|
{-# NOINLINE prefix_number #-}
|
||||||
prefix_number :: Name
|
prefix_number :: Name
|
||||||
@ -277,7 +277,7 @@ fromTypeVariableScheme scheme =
|
|||||||
--
|
--
|
||||||
-- Creating a unique name by combining all the subnames can create names
|
-- Creating a unique name by combining all the subnames can create names
|
||||||
-- longer than 256 bytes relatively easily. So instead, the first given name
|
-- longer than 256 bytes relatively easily. So instead, the first given name
|
||||||
-- (e.g. foo) is prefixed chars that are valid in JS but not Elm (e.g. _M$foo)
|
-- (e.g. foo) is prefixed chars that are valid in JS but not Gren (e.g. _M$foo)
|
||||||
--
|
--
|
||||||
-- This should be a unique name since 0.19 disallows shadowing. It would not
|
-- This should be a unique name since 0.19 disallows shadowing. It would not
|
||||||
-- be possible for multiple top-level cycles to include values with the same
|
-- be possible for multiple top-level cycles to include values with the same
|
||||||
@ -529,7 +529,7 @@ identity = fromChars "identity"
|
|||||||
|
|
||||||
{-# NOINLINE replModule #-}
|
{-# NOINLINE replModule #-}
|
||||||
replModule :: Name
|
replModule :: Name
|
||||||
replModule = fromChars "Elm_Repl"
|
replModule = fromChars "Gren_Repl"
|
||||||
|
|
||||||
{-# NOINLINE replValueToPrint #-}
|
{-# NOINLINE replValueToPrint #-}
|
||||||
replValueToPrint :: Name
|
replValueToPrint :: Name
|
||||||
|
@ -17,13 +17,13 @@ import qualified Data.Map as Map
|
|||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Data.Utf8 as Utf8
|
import qualified Data.Utf8 as Utf8
|
||||||
import qualified Elm.Kernel as K
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Generate.JavaScript.Builder as JS
|
import qualified Generate.JavaScript.Builder as JS
|
||||||
import qualified Generate.JavaScript.Expression as Expr
|
import qualified Generate.JavaScript.Expression as Expr
|
||||||
import qualified Generate.JavaScript.Functions as Functions
|
import qualified Generate.JavaScript.Functions as Functions
|
||||||
import qualified Generate.JavaScript.Name as JsName
|
import qualified Generate.JavaScript.Name as JsName
|
||||||
import qualified Generate.Mode as Mode
|
import qualified Generate.Mode as Mode
|
||||||
|
import qualified Gren.Kernel as K
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
import qualified Reporting.Render.Type as RT
|
import qualified Reporting.Render.Type as RT
|
||||||
import qualified Reporting.Render.Type.Localizer as L
|
import qualified Reporting.Render.Type.Localizer as L
|
||||||
@ -301,11 +301,11 @@ addChunk mode chunk builder =
|
|||||||
case chunk of
|
case chunk of
|
||||||
K.JS javascript ->
|
K.JS javascript ->
|
||||||
B.byteString javascript <> builder
|
B.byteString javascript <> builder
|
||||||
K.ElmVar home name ->
|
K.GrenVar home name ->
|
||||||
JsName.toBuilder (JsName.fromGlobal home name) <> builder
|
JsName.toBuilder (JsName.fromGlobal home name) <> builder
|
||||||
K.JsVar home name ->
|
K.JsVar home name ->
|
||||||
JsName.toBuilder (JsName.fromKernel home name) <> builder
|
JsName.toBuilder (JsName.fromKernel home name) <> builder
|
||||||
K.ElmField name ->
|
K.GrenField name ->
|
||||||
JsName.toBuilder (Expr.generateField mode name) <> builder
|
JsName.toBuilder (Expr.generateField mode name) <> builder
|
||||||
K.JsField int ->
|
K.JsField int ->
|
||||||
JsName.toBuilder (JsName.fromInt int) <> builder
|
JsName.toBuilder (JsName.fromInt int) <> builder
|
||||||
|
@ -23,14 +23,14 @@ import qualified Data.Map as Map
|
|||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Data.Utf8 as Utf8
|
import qualified Data.Utf8 as Utf8
|
||||||
import qualified Elm.Compiler.Type as Type
|
|
||||||
import qualified Elm.Compiler.Type.Extract as Extract
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified Elm.Version as V
|
|
||||||
import qualified Generate.JavaScript.Builder as JS
|
import qualified Generate.JavaScript.Builder as JS
|
||||||
import qualified Generate.JavaScript.Name as JsName
|
import qualified Generate.JavaScript.Name as JsName
|
||||||
import qualified Generate.Mode as Mode
|
import qualified Generate.Mode as Mode
|
||||||
|
import qualified Gren.Compiler.Type as Type
|
||||||
|
import qualified Gren.Compiler.Type.Extract as Extract
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
|
import qualified Gren.Version as V
|
||||||
import Json.Encode ((==>))
|
import Json.Encode ((==>))
|
||||||
import qualified Json.Encode as Encode
|
import qualified Json.Encode as Encode
|
||||||
import qualified Optimize.DecisionTree as DT
|
import qualified Optimize.DecisionTree as DT
|
||||||
@ -227,7 +227,7 @@ generateCtor mode (Opt.Global home name) index arity =
|
|||||||
|
|
||||||
ctorToInt :: ModuleName.Canonical -> Name.Name -> Index.ZeroBased -> Int
|
ctorToInt :: ModuleName.Canonical -> Name.Name -> Index.ZeroBased -> Int
|
||||||
ctorToInt home name index =
|
ctorToInt home name index =
|
||||||
if home == ModuleName.dict && name == "RBNode_elm_builtin" || name == "RBEmpty_elm_builtin"
|
if home == ModuleName.dict && name == "RBNode_gren_builtin" || name == "RBEmpty_gren_builtin"
|
||||||
then 0 - Index.toHuman index
|
then 0 - Index.toHuman index
|
||||||
else Index.toMachine index
|
else Index.toMachine index
|
||||||
|
|
||||||
@ -407,24 +407,24 @@ generateBitwiseCall home name args =
|
|||||||
generateBasicsCall :: Mode.Mode -> ModuleName.Canonical -> Name.Name -> [Opt.Expr] -> JS.Expr
|
generateBasicsCall :: Mode.Mode -> ModuleName.Canonical -> Name.Name -> [Opt.Expr] -> JS.Expr
|
||||||
generateBasicsCall mode home name args =
|
generateBasicsCall mode home name args =
|
||||||
case args of
|
case args of
|
||||||
[elmArg] ->
|
[grenArg] ->
|
||||||
let arg = generateJsExpr mode elmArg
|
let arg = generateJsExpr mode grenArg
|
||||||
in case name of
|
in case name of
|
||||||
"not" -> JS.Prefix JS.PrefixNot arg
|
"not" -> JS.Prefix JS.PrefixNot arg
|
||||||
"negate" -> JS.Prefix JS.PrefixNegate arg
|
"negate" -> JS.Prefix JS.PrefixNegate arg
|
||||||
"toFloat" -> arg
|
"toFloat" -> arg
|
||||||
"truncate" -> JS.Infix JS.OpBitwiseOr arg (JS.Int 0)
|
"truncate" -> JS.Infix JS.OpBitwiseOr arg (JS.Int 0)
|
||||||
_ -> generateGlobalCall home name [arg]
|
_ -> generateGlobalCall home name [arg]
|
||||||
[elmLeft, elmRight] ->
|
[grenLeft, grenRight] ->
|
||||||
case name of
|
case name of
|
||||||
-- NOTE: removed "composeL" and "composeR" because of this issue:
|
-- NOTE: removed "composeL" and "composeR" because of this issue:
|
||||||
-- https://github.com/elm/compiler/issues/1722
|
-- https://github.com/gren/compiler/issues/1722
|
||||||
"append" -> append mode elmLeft elmRight
|
"append" -> append mode grenLeft grenRight
|
||||||
"apL" -> generateJsExpr mode $ apply elmLeft elmRight
|
"apL" -> generateJsExpr mode $ apply grenLeft grenRight
|
||||||
"apR" -> generateJsExpr mode $ apply elmRight elmLeft
|
"apR" -> generateJsExpr mode $ apply grenRight grenLeft
|
||||||
_ ->
|
_ ->
|
||||||
let left = generateJsExpr mode elmLeft
|
let left = generateJsExpr mode grenLeft
|
||||||
right = generateJsExpr mode elmRight
|
right = generateJsExpr mode grenRight
|
||||||
in case name of
|
in case name of
|
||||||
"add" -> JS.Infix JS.OpAdd left right
|
"add" -> JS.Infix JS.OpAdd left right
|
||||||
"sub" -> JS.Infix JS.OpSub left right
|
"sub" -> JS.Infix JS.OpSub left right
|
||||||
@ -845,6 +845,6 @@ toDebugMetadata mode msgType =
|
|||||||
Mode.Dev (Just interfaces) ->
|
Mode.Dev (Just interfaces) ->
|
||||||
JS.Json $
|
JS.Json $
|
||||||
Encode.object $
|
Encode.object $
|
||||||
[ "versions" ==> Encode.object ["elm" ==> V.encode V.compiler],
|
[ "versions" ==> Encode.object ["gren" ==> V.encode V.compiler],
|
||||||
"types" ==> Type.encodeMetadata (Extract.fromMsg interfaces msgType)
|
"types" ==> Type.encodeMetadata (Extract.fromMsg interfaces msgType)
|
||||||
]
|
]
|
||||||
|
@ -25,8 +25,8 @@ import qualified Data.Name as Name
|
|||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Data.Utf8 as Utf8
|
import qualified Data.Utf8 as Utf8
|
||||||
import Data.Word (Word8)
|
import Data.Word (Word8)
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
|
|
||||||
-- NAME
|
-- NAME
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ usd =
|
|||||||
{-# NOINLINE reservedNames #-}
|
{-# NOINLINE reservedNames #-}
|
||||||
reservedNames :: Set.Set Name.Name
|
reservedNames :: Set.Set Name.Name
|
||||||
reservedNames =
|
reservedNames =
|
||||||
Set.union jsReservedWords elmReservedWords
|
Set.union jsReservedWords grenReservedWords
|
||||||
|
|
||||||
jsReservedWords :: Set.Set Name.Name
|
jsReservedWords :: Set.Set Name.Name
|
||||||
jsReservedWords =
|
jsReservedWords =
|
||||||
@ -175,8 +175,8 @@ jsReservedWords =
|
|||||||
"synchronized"
|
"synchronized"
|
||||||
]
|
]
|
||||||
|
|
||||||
elmReservedWords :: Set.Set Name.Name
|
grenReservedWords :: Set.Set Name.Name
|
||||||
elmReservedWords =
|
grenReservedWords =
|
||||||
Set.fromList
|
Set.fromList
|
||||||
[ "F2",
|
[ "F2",
|
||||||
"F3",
|
"F3",
|
||||||
|
@ -11,8 +11,8 @@ import qualified Data.List as List
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.Compiler.Type.Extract as Extract
|
|
||||||
import qualified Generate.JavaScript.Name as JsName
|
import qualified Generate.JavaScript.Name as JsName
|
||||||
|
import qualified Gren.Compiler.Type.Extract as Extract
|
||||||
|
|
||||||
-- MODE
|
-- MODE
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Compiler.Imports
|
module Gren.Compiler.Imports
|
||||||
( defaults,
|
( defaults,
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import qualified AST.Source as Src
|
import qualified AST.Source as Src
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
|
||||||
-- DEFAULTS
|
-- DEFAULTS
|
@ -1,7 +1,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -Wall -Wno-incomplete-uni-patterns #-}
|
{-# OPTIONS_GHC -Wall -Wno-incomplete-uni-patterns #-}
|
||||||
|
|
||||||
module Elm.Compiler.Type
|
module Gren.Compiler.Type
|
||||||
( Type (..),
|
( Type (..),
|
||||||
RT.Context (..),
|
RT.Context (..),
|
||||||
toDoc,
|
toDoc,
|
@ -3,7 +3,7 @@
|
|||||||
{-# LANGUAGE Rank2Types #-}
|
{-# LANGUAGE Rank2Types #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Compiler.Type.Extract
|
module Gren.Compiler.Type.Extract
|
||||||
( fromAnnotation,
|
( fromAnnotation,
|
||||||
fromType,
|
fromType,
|
||||||
Types (..),
|
Types (..),
|
||||||
@ -23,9 +23,9 @@ import qualified Data.Map as Map
|
|||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.Compiler.Type as T
|
import qualified Gren.Compiler.Type as T
|
||||||
import qualified Elm.Interface as I
|
import qualified Gren.Interface as I
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
|
||||||
-- EXTRACTION
|
-- EXTRACTION
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Constraint
|
module Gren.Constraint
|
||||||
( Constraint,
|
( Constraint,
|
||||||
exactly,
|
exactly,
|
||||||
anything,
|
anything,
|
||||||
@ -9,8 +9,8 @@ module Elm.Constraint
|
|||||||
satisfies,
|
satisfies,
|
||||||
check,
|
check,
|
||||||
intersect,
|
intersect,
|
||||||
goodElm,
|
goodGren,
|
||||||
defaultElm,
|
defaultGren,
|
||||||
untilNextMajor,
|
untilNextMajor,
|
||||||
untilNextMinor,
|
untilNextMinor,
|
||||||
expand,
|
expand,
|
||||||
@ -23,7 +23,7 @@ where
|
|||||||
|
|
||||||
import Control.Monad (liftM4)
|
import Control.Monad (liftM4)
|
||||||
import Data.Binary (Binary, get, getWord8, put, putWord8)
|
import Data.Binary (Binary, get, getWord8, put, putWord8)
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Json.Decode as D
|
import qualified Json.Decode as D
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
||||||
import Parse.Primitives (Col, Row)
|
import Parse.Primitives (Col, Row)
|
||||||
@ -111,14 +111,14 @@ intersect (Range lo lop hop hi) (Range lo_ lop_ hop_ hi_) =
|
|||||||
then Just (Range newLo newLop newHop newHi)
|
then Just (Range newLo newLop newHop newHi)
|
||||||
else Nothing
|
else Nothing
|
||||||
|
|
||||||
-- ELM CONSTRAINT
|
-- GREN CONSTRAINT
|
||||||
|
|
||||||
goodElm :: Constraint -> Bool
|
goodGren :: Constraint -> Bool
|
||||||
goodElm constraint =
|
goodGren constraint =
|
||||||
satisfies constraint V.compiler
|
satisfies constraint V.compiler
|
||||||
|
|
||||||
defaultElm :: Constraint
|
defaultGren :: Constraint
|
||||||
defaultElm =
|
defaultGren =
|
||||||
if V._major V.compiler > 0
|
if V._major V.compiler > 0
|
||||||
then untilNextMajor V.compiler
|
then untilNextMajor V.compiler
|
||||||
else untilNextMinor V.compiler
|
else untilNextMinor V.compiler
|
@ -4,7 +4,7 @@
|
|||||||
{-# LANGUAGE UnboxedTuples #-}
|
{-# LANGUAGE UnboxedTuples #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Docs
|
module Gren.Docs
|
||||||
( Documentation,
|
( Documentation,
|
||||||
Module (..),
|
Module (..),
|
||||||
fromModule,
|
fromModule,
|
||||||
@ -32,10 +32,10 @@ import qualified Data.Name as Name
|
|||||||
import qualified Data.NonEmptyList as NE
|
import qualified Data.NonEmptyList as NE
|
||||||
import qualified Data.OneOrMore as OneOrMore
|
import qualified Data.OneOrMore as OneOrMore
|
||||||
import Data.Word (Word8)
|
import Data.Word (Word8)
|
||||||
import qualified Elm.Compiler.Type as Type
|
|
||||||
import qualified Elm.Compiler.Type.Extract as Extract
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import Foreign.Ptr (Ptr, plusPtr)
|
import Foreign.Ptr (Ptr, plusPtr)
|
||||||
|
import qualified Gren.Compiler.Type as Type
|
||||||
|
import qualified Gren.Compiler.Type.Extract as Extract
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Json.Decode as D
|
import qualified Json.Decode as D
|
||||||
import Json.Encode ((==>))
|
import Json.Encode ((==>))
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
@ -2,7 +2,7 @@
|
|||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Float
|
module Gren.Float
|
||||||
( Float,
|
( Float,
|
||||||
fromPtr,
|
fromPtr,
|
||||||
toBuilder,
|
toBuilder,
|
||||||
@ -19,9 +19,9 @@ import Prelude hiding (Float)
|
|||||||
-- FLOATS
|
-- FLOATS
|
||||||
|
|
||||||
type Float =
|
type Float =
|
||||||
Utf8.Utf8 ELM_FLOAT
|
Utf8.Utf8 GREN_FLOAT
|
||||||
|
|
||||||
data ELM_FLOAT
|
data GREN_FLOAT
|
||||||
|
|
||||||
-- HELPERS
|
-- HELPERS
|
||||||
|
|
||||||
@ -36,6 +36,6 @@ toBuilder =
|
|||||||
|
|
||||||
-- BINARY
|
-- BINARY
|
||||||
|
|
||||||
instance Binary (Utf8.Utf8 ELM_FLOAT) where
|
instance Binary (Utf8.Utf8 GREN_FLOAT) where
|
||||||
get = Utf8.getUnder256
|
get = Utf8.getUnder256
|
||||||
put = Utf8.putUnder256
|
put = Utf8.putUnder256
|
@ -1,6 +1,6 @@
|
|||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Interface
|
module Gren.Interface
|
||||||
( Interface (..),
|
( Interface (..),
|
||||||
Union (..),
|
Union (..),
|
||||||
Alias (..),
|
Alias (..),
|
||||||
@ -25,7 +25,7 @@ import qualified Data.Map.Merge.Strict as Map
|
|||||||
import Data.Map.Strict ((!))
|
import Data.Map.Strict ((!))
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
|
||||||
-- INTERFACE
|
-- INTERFACE
|
@ -4,7 +4,7 @@
|
|||||||
{-# LANGUAGE UnboxedTuples #-}
|
{-# LANGUAGE UnboxedTuples #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Kernel
|
module Gren.Kernel
|
||||||
( Content (..),
|
( Content (..),
|
||||||
Chunk (..),
|
Chunk (..),
|
||||||
fromByteString,
|
fromByteString,
|
||||||
@ -20,11 +20,11 @@ import qualified Data.List as List
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import Data.Word (Word8)
|
import Data.Word (Word8)
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import Foreign.ForeignPtr (ForeignPtr)
|
import Foreign.ForeignPtr (ForeignPtr)
|
||||||
import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
|
import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
|
||||||
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Parse.Module as Module
|
import qualified Parse.Module as Module
|
||||||
import Parse.Primitives hiding (fromByteString)
|
import Parse.Primitives hiding (fromByteString)
|
||||||
import qualified Parse.Primitives as P
|
import qualified Parse.Primitives as P
|
||||||
@ -36,9 +36,9 @@ import qualified Reporting.Annotation as A
|
|||||||
|
|
||||||
data Chunk
|
data Chunk
|
||||||
= JS B.ByteString
|
= JS B.ByteString
|
||||||
| ElmVar ModuleName.Canonical Name.Name
|
| GrenVar ModuleName.Canonical Name.Name
|
||||||
| JsVar Name.Name Name.Name
|
| JsVar Name.Name Name.Name
|
||||||
| ElmField Name.Name
|
| GrenField Name.Name
|
||||||
| JsField Int
|
| JsField Int
|
||||||
| JsEnum Int
|
| JsEnum Int
|
||||||
| Debug
|
| Debug
|
||||||
@ -54,9 +54,9 @@ addField :: Chunk -> Map.Map Name.Name Int -> Map.Map Name.Name Int
|
|||||||
addField chunk fields =
|
addField chunk fields =
|
||||||
case chunk of
|
case chunk of
|
||||||
JS _ -> fields
|
JS _ -> fields
|
||||||
ElmVar _ _ -> fields
|
GrenVar _ _ -> fields
|
||||||
JsVar _ _ -> fields
|
JsVar _ _ -> fields
|
||||||
ElmField f -> Map.insertWith (+) f 1 fields
|
GrenField f -> Map.insertWith (+) f 1 fields
|
||||||
JsField _ -> fields
|
JsField _ -> fields
|
||||||
JsEnum _ -> fields
|
JsEnum _ -> fields
|
||||||
Debug -> fields
|
Debug -> fields
|
||||||
@ -148,7 +148,7 @@ chompTag vs es fs src pos end row col revChunks =
|
|||||||
then
|
then
|
||||||
let !name = Name.fromPtr pos newPos
|
let !name = Name.fromPtr pos newPos
|
||||||
in chompChunks vs es fs src newPos end row newCol newPos $
|
in chompChunks vs es fs src newPos end row newCol newPos $
|
||||||
ElmField name : revChunks
|
GrenField name : revChunks
|
||||||
else
|
else
|
||||||
let !name = Name.fromPtr tagPos newPos
|
let !name = Name.fromPtr tagPos newPos
|
||||||
in if 0x30 {-0-} <= word && word <= 0x39 {-9-}
|
in if 0x30 {-0-} <= word && word <= 0x39 {-9-}
|
||||||
@ -230,7 +230,7 @@ addImport pkg foreigns vtable (Src.Import (A.At _ importName) maybeAlias exposin
|
|||||||
let home = ModuleName.Canonical (Map.findWithDefault pkg importName foreigns) importName
|
let home = ModuleName.Canonical (Map.findWithDefault pkg importName foreigns) importName
|
||||||
prefix = toPrefix importName maybeAlias
|
prefix = toPrefix importName maybeAlias
|
||||||
add table name =
|
add table name =
|
||||||
Map.insert (Name.sepBy 0x5F {-_-} prefix name) (ElmVar home name) table
|
Map.insert (Name.sepBy 0x5F {-_-} prefix name) (GrenVar home name) table
|
||||||
in List.foldl' add vtable (toNames exposing)
|
in List.foldl' add vtable (toNames exposing)
|
||||||
|
|
||||||
toPrefix :: Name.Name -> Maybe Name.Name -> Name.Name
|
toPrefix :: Name.Name -> Maybe Name.Name -> Name.Name
|
||||||
@ -269,9 +269,9 @@ instance Binary Chunk where
|
|||||||
put chunk =
|
put chunk =
|
||||||
case chunk of
|
case chunk of
|
||||||
JS a -> putWord8 0 >> put a
|
JS a -> putWord8 0 >> put a
|
||||||
ElmVar a b -> putWord8 1 >> put a >> put b
|
GrenVar a b -> putWord8 1 >> put a >> put b
|
||||||
JsVar a b -> putWord8 2 >> put a >> put b
|
JsVar a b -> putWord8 2 >> put a >> put b
|
||||||
ElmField a -> putWord8 3 >> put a
|
GrenField a -> putWord8 3 >> put a
|
||||||
JsField a -> putWord8 4 >> put a
|
JsField a -> putWord8 4 >> put a
|
||||||
JsEnum a -> putWord8 5 >> put a
|
JsEnum a -> putWord8 5 >> put a
|
||||||
Debug -> putWord8 6
|
Debug -> putWord8 6
|
||||||
@ -282,11 +282,11 @@ instance Binary Chunk where
|
|||||||
word <- getWord8
|
word <- getWord8
|
||||||
case word of
|
case word of
|
||||||
0 -> liftM JS get
|
0 -> liftM JS get
|
||||||
1 -> liftM2 ElmVar get get
|
1 -> liftM2 GrenVar get get
|
||||||
2 -> liftM2 JsVar get get
|
2 -> liftM2 JsVar get get
|
||||||
3 -> liftM ElmField get
|
3 -> liftM GrenField get
|
||||||
4 -> liftM JsField get
|
4 -> liftM JsField get
|
||||||
5 -> liftM JsEnum get
|
5 -> liftM JsEnum get
|
||||||
6 -> return Debug
|
6 -> return Debug
|
||||||
7 -> return Prod
|
7 -> return Prod
|
||||||
_ -> error "problem deserializing Elm.Kernel.Chunk"
|
_ -> error "problem deserializing Gren.Kernel.Chunk"
|
@ -1,7 +1,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Licenses
|
module Gren.Licenses
|
||||||
( License,
|
( License,
|
||||||
bsd3,
|
bsd3,
|
||||||
encode,
|
encode,
|
@ -1,4 +1,4 @@
|
|||||||
module Elm.Magnitude
|
module Gren.Magnitude
|
||||||
( Magnitude (..),
|
( Magnitude (..),
|
||||||
toChars,
|
toChars,
|
||||||
)
|
)
|
@ -2,7 +2,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE UnboxedTuples #-}
|
{-# LANGUAGE UnboxedTuples #-}
|
||||||
|
|
||||||
module Elm.ModuleName
|
module Gren.ModuleName
|
||||||
( Raw,
|
( Raw,
|
||||||
toChars,
|
toChars,
|
||||||
toFilePath,
|
toFilePath,
|
||||||
@ -29,12 +29,6 @@ module Elm.ModuleName
|
|||||||
virtualDom,
|
virtualDom,
|
||||||
jsonDecode,
|
jsonDecode,
|
||||||
jsonEncode,
|
jsonEncode,
|
||||||
webgl,
|
|
||||||
texture,
|
|
||||||
vector2,
|
|
||||||
vector3,
|
|
||||||
vector4,
|
|
||||||
matrix4,
|
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
@ -43,8 +37,8 @@ import Data.Binary (Binary (..))
|
|||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Utf8 as Utf8
|
import qualified Data.Utf8 as Utf8
|
||||||
import Data.Word (Word8)
|
import Data.Word (Word8)
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Json.Decode as D
|
import qualified Json.Decode as D
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
||||||
import Parse.Primitives (Col, Row)
|
import Parse.Primitives (Col, Row)
|
||||||
@ -208,29 +202,3 @@ jsonDecode = Canonical Pkg.json "Json.Decode"
|
|||||||
{-# NOINLINE jsonEncode #-}
|
{-# NOINLINE jsonEncode #-}
|
||||||
jsonEncode :: Canonical
|
jsonEncode :: Canonical
|
||||||
jsonEncode = Canonical Pkg.json "Json.Encode"
|
jsonEncode = Canonical Pkg.json "Json.Encode"
|
||||||
|
|
||||||
-- WEBGL
|
|
||||||
|
|
||||||
{-# NOINLINE webgl #-}
|
|
||||||
webgl :: Canonical
|
|
||||||
webgl = Canonical Pkg.webgl "WebGL"
|
|
||||||
|
|
||||||
{-# NOINLINE texture #-}
|
|
||||||
texture :: Canonical
|
|
||||||
texture = Canonical Pkg.webgl "WebGL.Texture"
|
|
||||||
|
|
||||||
{-# NOINLINE vector2 #-}
|
|
||||||
vector2 :: Canonical
|
|
||||||
vector2 = Canonical Pkg.linearAlgebra "Math.Vector2"
|
|
||||||
|
|
||||||
{-# NOINLINE vector3 #-}
|
|
||||||
vector3 :: Canonical
|
|
||||||
vector3 = Canonical Pkg.linearAlgebra "Math.Vector3"
|
|
||||||
|
|
||||||
{-# NOINLINE vector4 #-}
|
|
||||||
vector4 :: Canonical
|
|
||||||
vector4 = Canonical Pkg.linearAlgebra "Math.Vector4"
|
|
||||||
|
|
||||||
{-# NOINLINE matrix4 #-}
|
|
||||||
matrix4 :: Canonical
|
|
||||||
matrix4 = Canonical Pkg.linearAlgebra "Math.Matrix4"
|
|
@ -4,7 +4,7 @@
|
|||||||
{-# LANGUAGE UnboxedTuples #-}
|
{-# LANGUAGE UnboxedTuples #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Package
|
module Gren.Package
|
||||||
( Name (..),
|
( Name (..),
|
||||||
Author,
|
Author,
|
||||||
Project,
|
Project,
|
||||||
@ -24,8 +24,6 @@ module Elm.Package
|
|||||||
json,
|
json,
|
||||||
http,
|
http,
|
||||||
url,
|
url,
|
||||||
webgl,
|
|
||||||
linearAlgebra,
|
|
||||||
--
|
--
|
||||||
suggestions,
|
suggestions,
|
||||||
nearbyNames,
|
nearbyNames,
|
||||||
@ -46,8 +44,8 @@ import qualified Data.Map as Map
|
|||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Utf8 as Utf8
|
import qualified Data.Utf8 as Utf8
|
||||||
import Data.Word (Word8)
|
import Data.Word (Word8)
|
||||||
import qualified Elm.Version as V
|
|
||||||
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified Json.Decode as D
|
import qualified Json.Decode as D
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
||||||
import qualified Json.String as Json
|
import qualified Json.String as Json
|
||||||
@ -82,7 +80,7 @@ data Canonical = Canonical
|
|||||||
|
|
||||||
isKernel :: Name -> Bool
|
isKernel :: Name -> Bool
|
||||||
isKernel (Name author _) =
|
isKernel (Name author _) =
|
||||||
author == elm || author == elm_explorations
|
author == gren
|
||||||
|
|
||||||
toChars :: Name -> String
|
toChars :: Name -> String
|
||||||
toChars (Name author project) =
|
toChars (Name author project) =
|
||||||
@ -114,70 +112,55 @@ dummyName =
|
|||||||
{-# NOINLINE kernel #-}
|
{-# NOINLINE kernel #-}
|
||||||
kernel :: Name
|
kernel :: Name
|
||||||
kernel =
|
kernel =
|
||||||
toName elm "kernel"
|
toName gren "kernel"
|
||||||
|
|
||||||
{-# NOINLINE core #-}
|
{-# NOINLINE core #-}
|
||||||
core :: Name
|
core :: Name
|
||||||
core =
|
core =
|
||||||
toName elm "core"
|
toName gren "core"
|
||||||
|
|
||||||
{-# NOINLINE browser #-}
|
{-# NOINLINE browser #-}
|
||||||
browser :: Name
|
browser :: Name
|
||||||
browser =
|
browser =
|
||||||
toName elm "browser"
|
toName gren "browser"
|
||||||
|
|
||||||
{-# NOINLINE virtualDom #-}
|
{-# NOINLINE virtualDom #-}
|
||||||
virtualDom :: Name
|
virtualDom :: Name
|
||||||
virtualDom =
|
virtualDom =
|
||||||
toName elm "virtual-dom"
|
toName gren "virtual-dom"
|
||||||
|
|
||||||
{-# NOINLINE html #-}
|
{-# NOINLINE html #-}
|
||||||
html :: Name
|
html :: Name
|
||||||
html =
|
html =
|
||||||
toName elm "html"
|
toName gren "html"
|
||||||
|
|
||||||
{-# NOINLINE json #-}
|
{-# NOINLINE json #-}
|
||||||
json :: Name
|
json :: Name
|
||||||
json =
|
json =
|
||||||
toName elm "json"
|
toName gren "json"
|
||||||
|
|
||||||
{-# NOINLINE http #-}
|
{-# NOINLINE http #-}
|
||||||
http :: Name
|
http :: Name
|
||||||
http =
|
http =
|
||||||
toName elm "http"
|
toName gren "http"
|
||||||
|
|
||||||
{-# NOINLINE url #-}
|
{-# NOINLINE url #-}
|
||||||
url :: Name
|
url :: Name
|
||||||
url =
|
url =
|
||||||
toName elm "url"
|
toName gren "url"
|
||||||
|
|
||||||
{-# NOINLINE webgl #-}
|
{-# NOINLINE gren #-}
|
||||||
webgl :: Name
|
gren :: Author
|
||||||
webgl =
|
gren =
|
||||||
toName elm_explorations "webgl"
|
Utf8.fromChars "gren"
|
||||||
|
|
||||||
{-# NOINLINE linearAlgebra #-}
|
|
||||||
linearAlgebra :: Name
|
|
||||||
linearAlgebra =
|
|
||||||
toName elm_explorations "linear-algebra"
|
|
||||||
|
|
||||||
{-# NOINLINE elm #-}
|
|
||||||
elm :: Author
|
|
||||||
elm =
|
|
||||||
Utf8.fromChars "elm"
|
|
||||||
|
|
||||||
{-# NOINLINE elm_explorations #-}
|
|
||||||
elm_explorations :: Author
|
|
||||||
elm_explorations =
|
|
||||||
Utf8.fromChars "elm-explorations"
|
|
||||||
|
|
||||||
-- PACKAGE SUGGESTIONS
|
-- PACKAGE SUGGESTIONS
|
||||||
|
|
||||||
suggestions :: Map.Map Name.Name Name
|
suggestions :: Map.Map Name.Name Name
|
||||||
suggestions =
|
suggestions =
|
||||||
let random = toName elm "random"
|
let random = toName gren "random"
|
||||||
time = toName elm "time"
|
time = toName gren "time"
|
||||||
file = toName elm "file"
|
file = toName gren "file"
|
||||||
in Map.fromList
|
in Map.fromList
|
||||||
[ "Browser" ==> browser,
|
[ "Browser" ==> browser,
|
||||||
"File" ==> file,
|
"File" ==> file,
|
||||||
@ -212,7 +195,7 @@ nearbyNames (Name author1 project1) possibleNames =
|
|||||||
|
|
||||||
authorDistance :: [Char] -> Author -> Int
|
authorDistance :: [Char] -> Author -> Int
|
||||||
authorDistance given possibility =
|
authorDistance given possibility =
|
||||||
if possibility == elm || possibility == elm_explorations
|
if possibility == gren
|
||||||
then 0
|
then 0
|
||||||
else abs (Suggest.distance given (Utf8.toChars possibility))
|
else abs (Suggest.distance given (Utf8.toChars possibility))
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}
|
{-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}
|
||||||
|
|
||||||
module Elm.String
|
module Gren.String
|
||||||
( String,
|
( String,
|
||||||
toChars,
|
toChars,
|
||||||
toBuilder,
|
toBuilder,
|
||||||
@ -26,9 +26,9 @@ import Prelude hiding (String)
|
|||||||
-- STRINGS
|
-- STRINGS
|
||||||
|
|
||||||
type String =
|
type String =
|
||||||
Utf8.Utf8 ELM_STRING
|
Utf8.Utf8 GREN_STRING
|
||||||
|
|
||||||
data ELM_STRING
|
data GREN_STRING
|
||||||
|
|
||||||
-- HELPERS
|
-- HELPERS
|
||||||
|
|
||||||
@ -116,6 +116,6 @@ writeHex mba !offset !bits =
|
|||||||
|
|
||||||
-- BINARY
|
-- BINARY
|
||||||
|
|
||||||
instance Binary (Utf8.Utf8 ELM_STRING) where
|
instance Binary (Utf8.Utf8 GREN_STRING) where
|
||||||
get = Utf8.getVeryLong
|
get = Utf8.getVeryLong
|
||||||
put = Utf8.putVeryLong
|
put = Utf8.putVeryLong
|
@ -2,7 +2,7 @@
|
|||||||
{-# LANGUAGE UnboxedTuples #-}
|
{-# LANGUAGE UnboxedTuples #-}
|
||||||
{-# OPTIONS_GHC -Wall #-}
|
{-# OPTIONS_GHC -Wall #-}
|
||||||
|
|
||||||
module Elm.Version
|
module Gren.Version
|
||||||
( Version (..),
|
( Version (..),
|
||||||
one,
|
one,
|
||||||
max,
|
max,
|
||||||
@ -58,7 +58,7 @@ compiler =
|
|||||||
[major] ->
|
[major] ->
|
||||||
Version major 0 0
|
Version major 0 0
|
||||||
[] ->
|
[] ->
|
||||||
error "could not detect version of elm-compiler you are using"
|
error "could not detect version of the compiler you are using"
|
||||||
|
|
||||||
-- BUMP
|
-- BUMP
|
||||||
|
|
@ -24,8 +24,8 @@ import qualified Data.Map as Map
|
|||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.NonEmptyList as NE
|
import qualified Data.NonEmptyList as NE
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.String as ES
|
import qualified Gren.String as ES
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
|
||||||
-- PATTERN
|
-- PATTERN
|
||||||
@ -262,8 +262,6 @@ checkExpr (A.At region expression) errors =
|
|||||||
errors
|
errors
|
||||||
Just c ->
|
Just c ->
|
||||||
checkExpr c errors
|
checkExpr c errors
|
||||||
Can.Shader _ _ ->
|
|
||||||
errors
|
|
||||||
|
|
||||||
-- CHECK FIELD
|
-- CHECK FIELD
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ import qualified Data.List as List
|
|||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.String as ES
|
import qualified Gren.String as ES
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
|
||||||
-- COMPILE CASES
|
-- COMPILE CASES
|
||||||
|
@ -10,13 +10,11 @@ where
|
|||||||
|
|
||||||
import qualified AST.Canonical as Can
|
import qualified AST.Canonical as Can
|
||||||
import qualified AST.Optimized as Opt
|
import qualified AST.Optimized as Opt
|
||||||
import qualified AST.Utils.Shader as Shader
|
|
||||||
import Control.Monad (foldM)
|
import Control.Monad (foldM)
|
||||||
import qualified Data.Index as Index
|
import qualified Data.Index as Index
|
||||||
import qualified Data.Map as Map
|
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Optimize.Case as Case
|
import qualified Optimize.Case as Case
|
||||||
import qualified Optimize.Names as Names
|
import qualified Optimize.Names as Names
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
@ -140,8 +138,6 @@ optimize cycle (A.At region expression) =
|
|||||||
<*> optimize cycle a
|
<*> optimize cycle a
|
||||||
<*> optimize cycle b
|
<*> optimize cycle b
|
||||||
<*> traverse (optimize cycle) maybeC
|
<*> traverse (optimize cycle) maybeC
|
||||||
Can.Shader src (Shader.Types attributes uniforms _varyings) ->
|
|
||||||
pure (Opt.Shader src (Map.keysSet attributes) (Map.keysSet uniforms))
|
|
||||||
|
|
||||||
-- UPDATE
|
-- UPDATE
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import Data.Map ((!))
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Optimize.Expression as Expr
|
import qualified Optimize.Expression as Expr
|
||||||
import qualified Optimize.Names as Names
|
import qualified Optimize.Names as Names
|
||||||
import qualified Optimize.Port as Port
|
import qualified Optimize.Port as Port
|
||||||
|
@ -22,7 +22,7 @@ import qualified Data.Index as Index
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
|
||||||
-- GENERATOR
|
-- GENERATOR
|
||||||
|
@ -15,7 +15,7 @@ import Control.Monad (foldM)
|
|||||||
import qualified Data.Index as Index
|
import qualified Data.Index as Index
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Optimize.Names as Names
|
import qualified Optimize.Names as Names
|
||||||
import Prelude hiding (maybe, null)
|
import Prelude hiding (maybe, null)
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ toEncoder tipe =
|
|||||||
do
|
do
|
||||||
encoder <- toEncoder fieldType
|
encoder <- toEncoder fieldType
|
||||||
let value = Opt.Call encoder [Opt.Access (Opt.VarLocal Name.dollar) name]
|
let value = Opt.Call encoder [Opt.Access (Opt.VarLocal Name.dollar) name]
|
||||||
return $ Opt.Tuple (Opt.Str (Name.toElmString name)) value Nothing
|
return $ Opt.Tuple (Opt.Str (Name.toGrenString name)) value Nothing
|
||||||
in do
|
in do
|
||||||
object <- encode "object"
|
object <- encode "object"
|
||||||
keyValuePairs <- traverse encodeField (Map.toList fields)
|
keyValuePairs <- traverse encodeField (Map.toList fields)
|
||||||
@ -271,7 +271,7 @@ fieldAndThen decoder (key, Can.FieldType _ tipe) =
|
|||||||
Opt.Call
|
Opt.Call
|
||||||
andThen
|
andThen
|
||||||
[ Opt.Function [key] decoder,
|
[ Opt.Function [key] decoder,
|
||||||
Opt.Call field [Opt.Str (Name.toElmString key), typeDecoder]
|
Opt.Call field [Opt.Str (Name.toGrenString key), typeDecoder]
|
||||||
]
|
]
|
||||||
|
|
||||||
-- GLOBALS HELPERS
|
-- GLOBALS HELPERS
|
||||||
|
@ -13,8 +13,8 @@ where
|
|||||||
import qualified AST.Source as Src
|
import qualified AST.Source as Src
|
||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.Compiler.Imports as Imports
|
import qualified Gren.Compiler.Imports as Imports
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Parse.Declaration as Decl
|
import qualified Parse.Declaration as Decl
|
||||||
import qualified Parse.Keyword as Keyword
|
import qualified Parse.Keyword as Keyword
|
||||||
import Parse.Primitives hiding (State, fromByteString)
|
import Parse.Primitives hiding (State, fromByteString)
|
||||||
|
@ -14,8 +14,8 @@ where
|
|||||||
|
|
||||||
import qualified AST.Utils.Binop as Binop
|
import qualified AST.Utils.Binop as Binop
|
||||||
import Data.Word (Word8)
|
import Data.Word (Word8)
|
||||||
import qualified Elm.Float as EF
|
|
||||||
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
||||||
|
import qualified Gren.Float as EF
|
||||||
import Parse.Primitives (Col, Parser, Row)
|
import Parse.Primitives (Col, Parser, Row)
|
||||||
import qualified Parse.Primitives as P
|
import qualified Parse.Primitives as P
|
||||||
import qualified Parse.Variable as Var
|
import qualified Parse.Variable as Var
|
||||||
|
@ -12,8 +12,8 @@ where
|
|||||||
|
|
||||||
import qualified Data.Utf8 as Utf8
|
import qualified Data.Utf8 as Utf8
|
||||||
import Data.Word (Word16, Word8)
|
import Data.Word (Word16, Word8)
|
||||||
import qualified Elm.String as ES
|
|
||||||
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
import Foreign.Ptr (Ptr, minusPtr, plusPtr)
|
||||||
|
import qualified Gren.String as ES
|
||||||
import qualified Parse.Number as Number
|
import qualified Parse.Number as Number
|
||||||
import Parse.Primitives (Col, Parser, Row)
|
import Parse.Primitives (Col, Parser, Row)
|
||||||
import qualified Parse.Primitives as P
|
import qualified Parse.Primitives as P
|
||||||
|
@ -65,8 +65,8 @@ where
|
|||||||
import qualified Data.Index as Index
|
import qualified Data.Index as Index
|
||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import Json.Encode ((==>))
|
import Json.Encode ((==>))
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
||||||
import qualified Json.String as Json
|
import qualified Json.String as Json
|
||||||
@ -172,11 +172,11 @@ fancyLink word before fileName after =
|
|||||||
|
|
||||||
makeLink :: [Char] -> [Char]
|
makeLink :: [Char] -> [Char]
|
||||||
makeLink fileName =
|
makeLink fileName =
|
||||||
"<https://elm-lang.org/" <> V.toChars V.compiler <> "/" <> fileName <> ">"
|
"<https://gren-lang.org/" <> V.toChars V.compiler <> "/" <> fileName <> ">"
|
||||||
|
|
||||||
makeNakedLink :: [Char] -> [Char]
|
makeNakedLink :: [Char] -> [Char]
|
||||||
makeNakedLink fileName =
|
makeNakedLink fileName =
|
||||||
"https://elm-lang.org/" <> V.toChars V.compiler <> "/" <> fileName
|
"https://gren-lang.org/" <> V.toChars V.compiler <> "/" <> fileName
|
||||||
|
|
||||||
reflowLink :: [Char] -> [Char] -> [Char] -> P.Doc
|
reflowLink :: [Char] -> [Char] -> [Char] -> P.Doc
|
||||||
reflowLink before fileName after =
|
reflowLink before fileName after =
|
||||||
|
@ -12,8 +12,8 @@ where
|
|||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.NonEmptyList as NE
|
import qualified Data.NonEmptyList as NE
|
||||||
import qualified Data.OneOrMore as OneOrMore
|
import qualified Data.OneOrMore as OneOrMore
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified File
|
import qualified File
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import Json.Encode ((==>))
|
import Json.Encode ((==>))
|
||||||
import qualified Json.Encode as E
|
import qualified Json.Encode as E
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
|
@ -22,7 +22,7 @@ import qualified Data.Map as Map
|
|||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.OneOrMore as OneOrMore
|
import qualified Data.OneOrMore as OneOrMore
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import Reporting.Doc (Doc, (<+>))
|
import Reporting.Doc (Doc, (<+>))
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
@ -422,7 +422,7 @@ toReport source err =
|
|||||||
source
|
source
|
||||||
region
|
region
|
||||||
Nothing
|
Nothing
|
||||||
( "Elm does not have a (===) operator like JavaScript.",
|
( "Gren does not have a (===) operator like JavaScript.",
|
||||||
"Switch to (==) instead."
|
"Switch to (==) instead."
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@ -434,7 +434,7 @@ toReport source err =
|
|||||||
region
|
region
|
||||||
Nothing
|
Nothing
|
||||||
( D.reflow $
|
( D.reflow $
|
||||||
"Elm uses a different name for the “not equal” operator:",
|
"Gren uses a different name for the “not equal” operator:",
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow "Switch to (/=) instead.",
|
[ D.reflow "Switch to (/=) instead.",
|
||||||
D.toSimpleNote $
|
D.toSimpleNote $
|
||||||
@ -465,14 +465,14 @@ toReport source err =
|
|||||||
region
|
region
|
||||||
Nothing
|
Nothing
|
||||||
( D.reflow $
|
( D.reflow $
|
||||||
"Elm does not use (%) as the remainder operator:",
|
"Gren does not use (%) as the remainder operator:",
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow $
|
[ D.reflow $
|
||||||
"If you want the behavior of (%) like in JavaScript, switch to:\
|
"If you want the behavior of (%) like in JavaScript, switch to:\
|
||||||
\ <https://package.elm-lang.org/packages/elm/core/latest/Basics#remainderBy>",
|
\ <https://package.gren-lang.org/packages/gren/core/latest/Basics#remainderBy>",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"If you want modular arithmetic like in math, switch to:\
|
"If you want modular arithmetic like in math, switch to:\
|
||||||
\ <https://package.elm-lang.org/packages/elm/core/latest/Basics#modBy>",
|
\ <https://package.gren-lang.org/packages/gren/core/latest/Basics#modBy>",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"The difference is how things work when negative numbers are involved."
|
"The difference is how things work when negative numbers are involved."
|
||||||
]
|
]
|
||||||
@ -542,7 +542,7 @@ toReport source err =
|
|||||||
D.reflow $
|
D.reflow $
|
||||||
"But functions cannot be sent in and out ports. If we allowed functions in from JS\
|
"But functions cannot be sent in and out ports. If we allowed functions in from JS\
|
||||||
\ they may perform some side-effects. If we let functions out, they could produce\
|
\ they may perform some side-effects. If we let functions out, they could produce\
|
||||||
\ incorrect results because Elm optimizations assume there are no side-effects."
|
\ incorrect results because Gren optimizations assume there are no side-effects."
|
||||||
)
|
)
|
||||||
TypeVariable name ->
|
TypeVariable name ->
|
||||||
( "an unspecified type",
|
( "an unspecified type",
|
||||||
@ -550,12 +550,12 @@ toReport source err =
|
|||||||
"But type variables like `" <> Name.toChars name
|
"But type variables like `" <> Name.toChars name
|
||||||
<> "` cannot flow through ports.\
|
<> "` cannot flow through ports.\
|
||||||
\ I need to know exactly what type of data I am getting, so I can guarantee that\
|
\ I need to know exactly what type of data I am getting, so I can guarantee that\
|
||||||
\ unexpected data cannot sneak in and crash the Elm program."
|
\ unexpected data cannot sneak in and crash the Gren program."
|
||||||
)
|
)
|
||||||
UnsupportedType name ->
|
UnsupportedType name ->
|
||||||
( "a `" <> Name.toChars name <> "` value",
|
( "a `" <> Name.toChars name <> "` value",
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow $ "I cannot handle that. The types that CAN flow in and out of Elm include:",
|
[ D.reflow $ "I cannot handle that. The types that CAN flow in and out of Gren include:",
|
||||||
D.indent 4 $
|
D.indent 4 $
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Ints, Floats, Bools, Strings, Maybes, Lists, Arrays,\
|
"Ints, Floats, Bools, Strings, Maybes, Lists, Arrays,\
|
||||||
@ -602,7 +602,7 @@ toReport source err =
|
|||||||
D.reflow $
|
D.reflow $
|
||||||
"It must produce a (Cmd msg) type. Notice the lower case `msg` type\
|
"It must produce a (Cmd msg) type. Notice the lower case `msg` type\
|
||||||
\ variable. The command will trigger some JS code, but it will not send\
|
\ variable. The command will trigger some JS code, but it will not send\
|
||||||
\ anything particular back to Elm."
|
\ anything particular back to Gren."
|
||||||
)
|
)
|
||||||
SubBad ->
|
SubBad ->
|
||||||
( "There is something off about this `" <> Name.toChars name <> "` port declaration.",
|
( "There is something off about this `" <> Name.toChars name <> "` port declaration.",
|
||||||
@ -638,7 +638,7 @@ toReport source err =
|
|||||||
"The `" <> Name.toChars name <> "` value is defined directly in terms of itself, causing an infinite loop.",
|
"The `" <> Name.toChars name <> "` value is defined directly in terms of itself, causing an infinite loop.",
|
||||||
D.stack
|
D.stack
|
||||||
[ makeTheory "Are you trying to mutate a variable?" $
|
[ makeTheory "Are you trying to mutate a variable?" $
|
||||||
"Elm does not have mutation, so when I see " ++ Name.toChars name
|
"Gren does not have mutation, so when I see " ++ Name.toChars name
|
||||||
++ " defined in terms of "
|
++ " defined in terms of "
|
||||||
++ Name.toChars name
|
++ Name.toChars name
|
||||||
++ ", I treat it as a recursive definition. Try giving the new value a new name!",
|
++ ", I treat it as a recursive definition. Try giving the new value a new name!",
|
||||||
@ -680,7 +680,7 @@ toReport source err =
|
|||||||
"The `" <> Name.toChars name <> "` value is defined directly in terms of itself, causing an infinite loop.",
|
"The `" <> Name.toChars name <> "` value is defined directly in terms of itself, causing an infinite loop.",
|
||||||
D.stack
|
D.stack
|
||||||
[ makeTheory "Are you trying to mutate a variable?" $
|
[ makeTheory "Are you trying to mutate a variable?" $
|
||||||
"Elm does not have mutation, so when I see " ++ Name.toChars name
|
"Gren does not have mutation, so when I see " ++ Name.toChars name
|
||||||
++ " defined in terms of "
|
++ " defined in terms of "
|
||||||
++ Name.toChars name
|
++ Name.toChars name
|
||||||
++ ", I treat it as a recursive definition. Try giving the new value a new name!",
|
++ ", I treat it as a recursive definition. Try giving the new value a new name!",
|
||||||
@ -731,7 +731,7 @@ toReport source err =
|
|||||||
"Think of a more helpful name for one of them and you should be all set!",
|
"Think of a more helpful name for one of them and you should be all set!",
|
||||||
D.link
|
D.link
|
||||||
"Note"
|
"Note"
|
||||||
"Linters advise against shadowing, so Elm makes “best practices” the default. Read"
|
"Linters advise against shadowing, so Gren makes “best practices” the default. Read"
|
||||||
"shadowing"
|
"shadowing"
|
||||||
"for more details on this choice."
|
"for more details on this choice."
|
||||||
]
|
]
|
||||||
@ -750,7 +750,7 @@ toReport source err =
|
|||||||
"Note"
|
"Note"
|
||||||
"Read"
|
"Read"
|
||||||
"tuples"
|
"tuples"
|
||||||
"for more comprehensive advice on working with large chunks of data in Elm."
|
"for more comprehensive advice on working with large chunks of data in Gren."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
TypeVarsUnboundInUnion unionRegion typeName allVars unbound unbounds ->
|
TypeVarsUnboundInUnion unionRegion typeName allVars unbound unbounds ->
|
||||||
@ -1005,13 +1005,13 @@ notFound source region maybePrefix name thing (PossibleNames locals quals) =
|
|||||||
[] ->
|
[] ->
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow noSuggestionDetails,
|
[ D.reflow noSuggestionDetails,
|
||||||
D.link "Hint" "Read" "imports" "to see how `import` declarations work in Elm."
|
D.link "Hint" "Read" "imports" "to see how `import` declarations work in Gren."
|
||||||
]
|
]
|
||||||
suggestions ->
|
suggestions ->
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow yesSuggestionDetails,
|
[ D.reflow yesSuggestionDetails,
|
||||||
D.indent 4 $ D.vcat $ map D.dullyellow $ map D.fromChars suggestions,
|
D.indent 4 $ D.vcat $ map D.dullyellow $ map D.fromChars suggestions,
|
||||||
D.link "Hint" "Read" "imports" "to see how `import` declarations work in Elm."
|
D.link "Hint" "Read" "imports" "to see how `import` declarations work in Gren."
|
||||||
]
|
]
|
||||||
in Report.Report "NAMING ERROR" region nearbyNames $
|
in Report.Report "NAMING ERROR" region nearbyNames $
|
||||||
Code.toSnippet
|
Code.toSnippet
|
||||||
@ -1100,22 +1100,22 @@ notEqualsHint :: Text -> [Doc]
|
|||||||
notEqualsHint op =
|
notEqualsHint op =
|
||||||
[ "Looking", "for", "the", "“not", "equal”", "operator?", "The", "traditional"
|
[ "Looking", "for", "the", "“not", "equal”", "operator?", "The", "traditional"
|
||||||
, D.dullyellow $ text $ "(" <> op <> ")"
|
, D.dullyellow $ text $ "(" <> op <> ")"
|
||||||
, "is", "replaced", "by", D.green "(/=)", "in", "Elm.", "It", "is", "meant"
|
, "is", "replaced", "by", D.green "(/=)", "in", "Gren.", "It", "is", "meant"
|
||||||
, "to", "look", "like", "the", "“not", "equal”", "sign", "from", "math!", "(≠)"
|
, "to", "look", "like", "the", "“not", "equal”", "sign", "from", "math!", "(≠)"
|
||||||
]
|
]
|
||||||
|
|
||||||
equalsHint :: [Doc]
|
equalsHint :: [Doc]
|
||||||
equalsHint =
|
equalsHint =
|
||||||
[ "A", "special", D.dullyellow "(===)", "operator", "is", "not", "needed"
|
[ "A", "special", D.dullyellow "(===)", "operator", "is", "not", "needed"
|
||||||
, "in", "Elm.", "We", "use", D.green "(==)", "for", "everything!"
|
, "in", "Gren.", "We", "use", D.green "(==)", "for", "everything!"
|
||||||
]
|
]
|
||||||
|
|
||||||
modHint :: [Doc]
|
modHint :: [Doc]
|
||||||
modHint =
|
modHint =
|
||||||
[ "Rather", "than", "a", D.dullyellow "(%)", "operator,"
|
[ "Rather", "than", "a", D.dullyellow "(%)", "operator,"
|
||||||
, "Elm", "has", "a", D.green "modBy", "function."
|
, "Gren", "has", "a", D.green "modBy", "function."
|
||||||
, "Learn", "more", "here:"
|
, "Learn", "more", "here:"
|
||||||
, "<https://package.elm-lang.org/packages/elm/core/latest/Basics#modBy>"
|
, "<https://package.gren-lang.org/packages/gren/core/latest/Basics#modBy>"
|
||||||
]
|
]
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
@ -9,8 +9,8 @@ where
|
|||||||
|
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
import qualified Reporting.Render.Code as Code
|
import qualified Reporting.Render.Code as Code
|
||||||
@ -47,7 +47,7 @@ toReport source (Error region name unimportedModules problem) =
|
|||||||
"You are trying to import a `" ++ ModuleName.toChars name ++ "` module:",
|
"You are trying to import a `" ++ ModuleName.toChars name ++ "` module:",
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow $
|
[ D.reflow $
|
||||||
"I checked the \"dependencies\" and \"source-directories\" listed in your elm.json,\
|
"I checked the \"dependencies\" and \"source-directories\" listed in your gren.json,\
|
||||||
\ but I cannot find it! Maybe it is a typo for one of these names?",
|
\ but I cannot find it! Maybe it is a typo for one of these names?",
|
||||||
D.dullyellow $
|
D.dullyellow $
|
||||||
D.indent 4 $
|
D.indent 4 $
|
||||||
@ -57,7 +57,7 @@ toReport source (Error region name unimportedModules problem) =
|
|||||||
Nothing ->
|
Nothing ->
|
||||||
D.toSimpleHint $
|
D.toSimpleHint $
|
||||||
"If it is not a typo, check the \"dependencies\" and \"source-directories\"\
|
"If it is not a typo, check the \"dependencies\" and \"source-directories\"\
|
||||||
\ of your elm.json to make sure all the packages you need are listed there!"
|
\ of your gren.json to make sure all the packages you need are listed there!"
|
||||||
Just dependency ->
|
Just dependency ->
|
||||||
D.toFancyHint
|
D.toFancyHint
|
||||||
[ "Maybe",
|
[ "Maybe",
|
||||||
@ -72,7 +72,7 @@ toReport source (Error region name unimportedModules problem) =
|
|||||||
D.fromChars (Pkg.toChars dependency),
|
D.fromChars (Pkg.toChars dependency),
|
||||||
"package?",
|
"package?",
|
||||||
"Running",
|
"Running",
|
||||||
D.green (D.fromChars ("elm install " ++ Pkg.toChars dependency)),
|
D.green (D.fromChars ("gren install " ++ Pkg.toChars dependency)),
|
||||||
"should",
|
"should",
|
||||||
"make",
|
"make",
|
||||||
"it",
|
"it",
|
||||||
|
@ -8,7 +8,7 @@ module Reporting.Error.Pattern
|
|||||||
where
|
where
|
||||||
|
|
||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Elm.String as ES
|
import qualified Gren.String as ES
|
||||||
import qualified Nitpick.PatternMatches as P
|
import qualified Nitpick.PatternMatches as P
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
import qualified Reporting.Render.Code as Code
|
import qualified Reporting.Render.Code as Code
|
||||||
|
@ -48,7 +48,7 @@ where
|
|||||||
import qualified Data.Char as Char
|
import qualified Data.Char as Char
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import Data.Word (Word16)
|
import Data.Word (Word16)
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import Numeric (showHex)
|
import Numeric (showHex)
|
||||||
import Parse.Primitives (Col, Row)
|
import Parse.Primitives (Col, Row)
|
||||||
import Parse.Symbol (BadOperator (..))
|
import Parse.Symbol (BadOperator (..))
|
||||||
@ -575,18 +575,18 @@ toReport source err =
|
|||||||
region
|
region
|
||||||
Nothing
|
Nothing
|
||||||
( D.reflow $
|
( D.reflow $
|
||||||
"It is not possible to declare an `effect module` outside the @elm organization,\
|
"It is not possible to declare an `effect module` outside the @gren organization,\
|
||||||
\ so I am getting stuck here:",
|
\ so I am getting stuck here:",
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow $
|
[ D.reflow $
|
||||||
"Switch to a normal module declaration.",
|
"Switch to a normal module declaration.",
|
||||||
D.toSimpleNote $
|
D.toSimpleNote $
|
||||||
"Effect modules are designed to allow certain core functionality to be\
|
"Effect modules are designed to allow certain core functionality to be\
|
||||||
\ defined separately from the compiler. So the @elm organization has access to\
|
\ defined separately from the compiler. So the @gren organization has access to\
|
||||||
\ this so that certain changes, extensions, and fixes can be introduced without\
|
\ this so that certain changes, extensions, and fixes can be introduced without\
|
||||||
\ needing to release new Elm binaries. For example, we want to make it possible\
|
\ needing to release new Gren binaries. For example, we want to make it possible\
|
||||||
\ to test effects, but this may require changes to the design of effect modules.\
|
\ to test effects, but this may require changes to the design of effect modules.\
|
||||||
\ By only having them defined in the @elm organization, that kind of design work\
|
\ By only having them defined in the @gren organization, that kind of design work\
|
||||||
\ can proceed much more smoothly."
|
\ can proceed much more smoothly."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -598,7 +598,7 @@ noteForPortsInPackage =
|
|||||||
D.stack
|
D.stack
|
||||||
[ D.toSimpleNote $
|
[ D.toSimpleNote $
|
||||||
"One of the major goals of the package ecosystem is to be completely written\
|
"One of the major goals of the package ecosystem is to be completely written\
|
||||||
\ in Elm. This means when you install an Elm package, you can be sure you are safe\
|
\ in Gren. This means when you install an Gren package, you can be sure you are safe\
|
||||||
\ from security issues on install and that you are not going to get any runtime\
|
\ from security issues on install and that you are not going to get any runtime\
|
||||||
\ exceptions coming from your new dependency. This design also sets the ecosystem\
|
\ exceptions coming from your new dependency. This design also sets the ecosystem\
|
||||||
\ up to target other platforms more easily (like mobile phones, WebAssembly, etc.)\
|
\ up to target other platforms more easily (like mobile phones, WebAssembly, etc.)\
|
||||||
@ -724,7 +724,7 @@ toParseErrorReport source modul =
|
|||||||
( D.reflow $
|
( D.reflow $
|
||||||
"I cannot parse this module declaration:",
|
"I cannot parse this module declaration:",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"This type of module is reserved for the @elm organization. It is used to\
|
"This type of module is reserved for the @gren organization. It is used to\
|
||||||
\ define certain effects, avoiding building them into the compiler."
|
\ define certain effects, avoiding building them into the compiler."
|
||||||
)
|
)
|
||||||
FreshLine row col ->
|
FreshLine row col ->
|
||||||
@ -756,7 +756,7 @@ toParseErrorReport source modul =
|
|||||||
"I got stuck here:",
|
"I got stuck here:",
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow $
|
[ D.reflow $
|
||||||
"I am not sure what is going on, but I recommend starting an Elm\
|
"I am not sure what is going on, but I recommend starting an Gren\
|
||||||
\ file with the following lines:",
|
\ file with the following lines:",
|
||||||
D.indent 4 $
|
D.indent 4 $
|
||||||
D.vcat $
|
D.vcat $
|
||||||
@ -767,7 +767,7 @@ toParseErrorReport source modul =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"You should be able to copy those lines directly into your file. Check out the\
|
"You should be able to copy those lines directly into your file. Check out the\
|
||||||
\ examples at <https://elm-lang.org/examples> for more help getting started!",
|
\ examples at <https://gren-lang.org/examples> for more help getting started!",
|
||||||
D.toSimpleNote $
|
D.toSimpleNote $
|
||||||
"This can also happen when something is indented too much!"
|
"This can also happen when something is indented too much!"
|
||||||
]
|
]
|
||||||
@ -866,7 +866,7 @@ toParseErrorReport source modul =
|
|||||||
( D.reflow $
|
( D.reflow $
|
||||||
"Something went wrong in this infix operator declaration:",
|
"Something went wrong in this infix operator declaration:",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"This feature is used by the @elm organization to define the\
|
"This feature is used by the @gren organization to define the\
|
||||||
\ languages built-in operators."
|
\ languages built-in operators."
|
||||||
)
|
)
|
||||||
Declarations decl _ _ ->
|
Declarations decl _ _ ->
|
||||||
@ -957,10 +957,10 @@ toWeirdEndReport source row col =
|
|||||||
D.toSimpleNote $
|
D.toSimpleNote $
|
||||||
"Some languages require semicolons at the end of each statement. These are\
|
"Some languages require semicolons at the end of each statement. These are\
|
||||||
\ often called C-like languages, and they usually share a lot of language design\
|
\ often called C-like languages, and they usually share a lot of language design\
|
||||||
\ choices. (E.g. side-effects, for loops, etc.) Elm manages effects with commands\
|
\ choices. (E.g. side-effects, for loops, etc.) Gren manages effects with commands\
|
||||||
\ and subscriptions instead, so there is no special syntax for \"statements\" and\
|
\ and subscriptions instead, so there is no special syntax for \"statements\" and\
|
||||||
\ therefore no need to use semicolons to separate them. I think this will make\
|
\ therefore no need to use semicolons to separate them. I think this will make\
|
||||||
\ more sense as you work through <https://guide.elm-lang.org> though!"
|
\ more sense as you work through <https://guide.gren-lang.org> though!"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
Just ',' ->
|
Just ',' ->
|
||||||
@ -991,9 +991,9 @@ toWeirdEndReport source row col =
|
|||||||
"I got stuck on this character:",
|
"I got stuck on this character:",
|
||||||
D.stack
|
D.stack
|
||||||
[ D.reflow $
|
[ D.reflow $
|
||||||
"It is not used for anything in Elm syntax. It is used for multi-line strings in\
|
"It is not used for anything in Gren syntax. It is used for multi-line strings in\
|
||||||
\ some languages though, so if you want a string that spans multiple lines, you\
|
\ some languages though, so if you want a string that spans multiple lines, you\
|
||||||
\ can use Elm's multi-line string syntax like this:",
|
\ can use Gren's multi-line string syntax like this:",
|
||||||
D.dullyellow $
|
D.dullyellow $
|
||||||
D.indent 4 $
|
D.indent 4 $
|
||||||
D.vcat $
|
D.vcat $
|
||||||
@ -1019,7 +1019,7 @@ toWeirdEndReport source row col =
|
|||||||
( D.reflow $
|
( D.reflow $
|
||||||
"I got stuck on this dollar sign:",
|
"I got stuck on this dollar sign:",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"It is not used for anything in Elm syntax. Are you coming from a language where\
|
"It is not used for anything in Gren syntax. Are you coming from a language where\
|
||||||
\ dollar signs can be used in variable names? If so, try a name that (1) starts\
|
\ dollar signs can be used in variable names? If so, try a name that (1) starts\
|
||||||
\ with a letter and (2) only contains letters, numbers, and underscores."
|
\ with a letter and (2) only contains letters, numbers, and underscores."
|
||||||
)
|
)
|
||||||
@ -1033,7 +1033,7 @@ toWeirdEndReport source row col =
|
|||||||
( D.reflow $
|
( D.reflow $
|
||||||
"I got stuck on this symbol:",
|
"I got stuck on this symbol:",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"It is not used for anything in Elm syntax. Try removing it?"
|
"It is not used for anything in Gren syntax. Try removing it?"
|
||||||
)
|
)
|
||||||
_ ->
|
_ ->
|
||||||
Report.Report "SYNTAX PROBLEM" region [] $
|
Report.Report "SYNTAX PROBLEM" region [] $
|
||||||
@ -1376,7 +1376,7 @@ toSpaceReport source space row col =
|
|||||||
region
|
region
|
||||||
Nothing
|
Nothing
|
||||||
( D.reflow $
|
( D.reflow $
|
||||||
"I ran into a tab, but tabs are not allowed in Elm files.",
|
"I ran into a tab, but tabs are not allowed in Gren files.",
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Replace the tab with spaces."
|
"Replace the tab with spaces."
|
||||||
)
|
)
|
||||||
@ -1392,7 +1392,7 @@ toSpaceReport source space row col =
|
|||||||
D.stack -- "{-"
|
D.stack -- "{-"
|
||||||
[ D.reflow "Add a -} somewhere after this to end the comment.",
|
[ D.reflow "Add a -} somewhere after this to end the comment.",
|
||||||
D.toSimpleHint
|
D.toSimpleHint
|
||||||
"Multi-line comments can be nested in Elm, so {- {- -} -} is a comment\
|
"Multi-line comments can be nested in Gren, so {- {- -} -} is a comment\
|
||||||
\ that happens to contain another comment. Like parentheses and curly braces,\
|
\ that happens to contain another comment. Like parentheses and curly braces,\
|
||||||
\ the start and end markers must always be balanced. Maybe that is the problem?"
|
\ the start and end markers must always be balanced. Maybe that is the problem?"
|
||||||
]
|
]
|
||||||
@ -2267,7 +2267,7 @@ toDeclDefReport source name declDef startRow startCol =
|
|||||||
"is",
|
"is",
|
||||||
"reserved",
|
"reserved",
|
||||||
"in",
|
"in",
|
||||||
"Elm,",
|
"Gren,",
|
||||||
"so",
|
"so",
|
||||||
"it",
|
"it",
|
||||||
"cannot",
|
"cannot",
|
||||||
@ -2310,7 +2310,7 @@ toDeclDefReport source name declDef startRow startCol =
|
|||||||
]
|
]
|
||||||
_ ->
|
_ ->
|
||||||
D.toSimpleNote $
|
D.toSimpleNote $
|
||||||
"The `" ++ keyword ++ "` keyword has a special meaning in Elm, so it can only be used in certain situations."
|
"The `" ++ keyword ++ "` keyword has a special meaning in Gren, so it can only be used in certain situations."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
Code.Operator "->" ->
|
Code.Operator "->" ->
|
||||||
@ -2516,7 +2516,7 @@ declDefNote =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"The top line (called a \"type annotation\") is optional. You can leave it off\
|
"The top line (called a \"type annotation\") is optional. You can leave it off\
|
||||||
\ if you want. As you get more comfortable with Elm and as your project grows,\
|
\ if you want. As you get more comfortable with Gren and as your project grows,\
|
||||||
\ it becomes more and more valuable to add them though! They work great as\
|
\ it becomes more and more valuable to add them though! They work great as\
|
||||||
\ compiler-verified documentation, and they often improve error messages!"
|
\ compiler-verified documentation, and they often improve error messages!"
|
||||||
]
|
]
|
||||||
@ -2873,7 +2873,7 @@ toCharReport source char row col =
|
|||||||
D.indent 4 $
|
D.indent 4 $
|
||||||
D.dullyellow "'this'" <> " => " <> D.green "\"this\"",
|
D.dullyellow "'this'" <> " => " <> D.green "\"this\"",
|
||||||
D.toSimpleNote $
|
D.toSimpleNote $
|
||||||
"Elm uses double quotes for strings like \"hello\", whereas it uses single\
|
"Gren uses double quotes for strings like \"hello\", whereas it uses single\
|
||||||
\ quotes for individual characters like 'a' and 'ø'. This distinction helps with\
|
\ quotes for individual characters like 'a' and 'ø'. This distinction helps with\
|
||||||
\ code like (String.any (\\c -> c == 'X') \"90210\") where you are inspecting\
|
\ code like (String.any (\\c -> c == 'X') \"90210\") where you are inspecting\
|
||||||
\ individual characters."
|
\ individual characters."
|
||||||
@ -3148,7 +3148,7 @@ toNumberReport source number row col =
|
|||||||
"Some languages let you to specify octal numbers by adding a leading zero.\
|
"Some languages let you to specify octal numbers by adding a leading zero.\
|
||||||
\ So in C, writing 0111 is the same as writing 73. Some people are used to\
|
\ So in C, writing 0111 is the same as writing 73. Some people are used to\
|
||||||
\ that, but others probably want it to equal 111. Either path is going to\
|
\ that, but others probably want it to equal 111. Either path is going to\
|
||||||
\ surprise people from certain backgrounds, so Elm tries to avoid this whole\
|
\ surprise people from certain backgrounds, so Gren tries to avoid this whole\
|
||||||
\ situation."
|
\ situation."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -3534,7 +3534,7 @@ toLetDefReport source name def startRow startCol =
|
|||||||
"is",
|
"is",
|
||||||
"reserved",
|
"reserved",
|
||||||
"in",
|
"in",
|
||||||
"Elm,",
|
"Gren,",
|
||||||
"so",
|
"so",
|
||||||
"it",
|
"it",
|
||||||
"cannot",
|
"cannot",
|
||||||
@ -3577,7 +3577,7 @@ toLetDefReport source name def startRow startCol =
|
|||||||
]
|
]
|
||||||
_ ->
|
_ ->
|
||||||
D.toSimpleNote $
|
D.toSimpleNote $
|
||||||
"The `" ++ keyword ++ "` keyword has a special meaning in Elm, so it can only be used in certain situations."
|
"The `" ++ keyword ++ "` keyword has a special meaning in Gren, so it can only be used in certain situations."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
Code.Operator "->" ->
|
Code.Operator "->" ->
|
||||||
@ -3764,7 +3764,7 @@ defNote =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"The top line (called a \"type annotation\") is optional. You can leave it off\
|
"The top line (called a \"type annotation\") is optional. You can leave it off\
|
||||||
\ if you want. As you get more comfortable with Elm and as your project grows,\
|
\ if you want. As you get more comfortable with Gren and as your project grows,\
|
||||||
\ it becomes more and more valuable to add them though! They work great as\
|
\ it becomes more and more valuable to add them though! They work great as\
|
||||||
\ compiler-verified documentation, and they often improve error messages!"
|
\ compiler-verified documentation, and they often improve error messages!"
|
||||||
]
|
]
|
||||||
@ -4664,7 +4664,7 @@ noteForRecordError =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
||||||
\ This is the stylistic convention in the Elm ecosystem."
|
\ This is the stylistic convention in the Gren ecosystem."
|
||||||
]
|
]
|
||||||
|
|
||||||
noteForRecordIndentError :: D.Doc
|
noteForRecordIndentError :: D.Doc
|
||||||
@ -4682,7 +4682,7 @@ noteForRecordIndentError =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
||||||
\ This is the stylistic convention in the Elm ecosystem!"
|
\ This is the stylistic convention in the Gren ecosystem!"
|
||||||
]
|
]
|
||||||
|
|
||||||
-- TUPLE
|
-- TUPLE
|
||||||
@ -4901,7 +4901,7 @@ toListReport source context list startRow startCol =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
||||||
\ This is the stylistic convention in the Elm ecosystem."
|
\ This is the stylistic convention in the Gren ecosystem."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
_ ->
|
_ ->
|
||||||
@ -5003,7 +5003,7 @@ toListReport source context list startRow startCol =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
||||||
\ This is the stylistic convention in the Elm ecosystem."
|
\ This is the stylistic convention in the Gren ecosystem."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
ListIndentEnd row col ->
|
ListIndentEnd row col ->
|
||||||
@ -5046,7 +5046,7 @@ toListReport source context list startRow startCol =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
||||||
\ This is the stylistic convention in the Elm ecosystem."
|
\ This is the stylistic convention in the Gren ecosystem."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
ListIndentExpr row col ->
|
ListIndentExpr row col ->
|
||||||
@ -5073,7 +5073,7 @@ toListReport source context list startRow startCol =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
||||||
\ This is the stylistic convention in the Elm ecosystem."
|
\ This is the stylistic convention in the Gren ecosystem."
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -6441,7 +6441,7 @@ noteForRecordTypeError =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
||||||
\ This is the stylistic convention in the Elm ecosystem."
|
\ This is the stylistic convention in the Gren ecosystem."
|
||||||
]
|
]
|
||||||
|
|
||||||
noteForRecordTypeIndentError :: D.Doc
|
noteForRecordTypeIndentError :: D.Doc
|
||||||
@ -6459,7 +6459,7 @@ noteForRecordTypeIndentError =
|
|||||||
],
|
],
|
||||||
D.reflow $
|
D.reflow $
|
||||||
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
"Notice that each line starts with some indentation. Usually two or four spaces.\
|
||||||
\ This is the stylistic convention in the Elm ecosystem."
|
\ This is the stylistic convention in the Gren ecosystem."
|
||||||
]
|
]
|
||||||
|
|
||||||
toTTupleReport :: Code.Source -> TContext -> TTuple -> Row -> Col -> Report.Report
|
toTTupleReport :: Code.Source -> TContext -> TTuple -> Row -> Col -> Report.Report
|
||||||
|
@ -15,7 +15,7 @@ import qualified AST.Source as Src
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
|
|
||||||
|
@ -8,11 +8,10 @@ module Type.Constrain.Expression
|
|||||||
where
|
where
|
||||||
|
|
||||||
import qualified AST.Canonical as Can
|
import qualified AST.Canonical as Can
|
||||||
import qualified AST.Utils.Shader as Shader
|
|
||||||
import qualified Data.Index as Index
|
import qualified Data.Index as Index
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import Reporting.Error.Type (Category (..), Context (..), Expected (..), MaybeName (..), PContext (..), PExpected (..), SubContext (..))
|
import Reporting.Error.Type (Category (..), Context (..), Expected (..), MaybeName (..), PContext (..), PExpected (..), SubContext (..))
|
||||||
import qualified Reporting.Error.Type as E
|
import qualified Reporting.Error.Type as E
|
||||||
@ -122,8 +121,6 @@ constrain rtv (A.At region expression) expected =
|
|||||||
return $ CEqual region Unit UnitN expected
|
return $ CEqual region Unit UnitN expected
|
||||||
Can.Tuple a b maybeC ->
|
Can.Tuple a b maybeC ->
|
||||||
constrainTuple rtv region a b maybeC expected
|
constrainTuple rtv region a b maybeC expected
|
||||||
Can.Shader _src types ->
|
|
||||||
constrainShader region types expected
|
|
||||||
|
|
||||||
-- CONSTRAIN LAMBDA
|
-- CONSTRAIN LAMBDA
|
||||||
|
|
||||||
@ -427,46 +424,6 @@ constrainTuple rtv region a b maybeC expected =
|
|||||||
|
|
||||||
return $ exists [aVar, bVar, cVar] $ CAnd [aCon, bCon, cCon, tupleCon]
|
return $ exists [aVar, bVar, cVar] $ CAnd [aCon, bCon, cCon, tupleCon]
|
||||||
|
|
||||||
-- CONSTRAIN SHADER
|
|
||||||
|
|
||||||
constrainShader :: A.Region -> Shader.Types -> Expected Type -> IO Constraint
|
|
||||||
constrainShader region (Shader.Types attributes uniforms varyings) expected =
|
|
||||||
do
|
|
||||||
attrVar <- mkFlexVar
|
|
||||||
unifVar <- mkFlexVar
|
|
||||||
let attrType = VarN attrVar
|
|
||||||
let unifType = VarN unifVar
|
|
||||||
|
|
||||||
let shaderType =
|
|
||||||
AppN
|
|
||||||
ModuleName.webgl
|
|
||||||
Name.shader
|
|
||||||
[ toShaderRecord attributes attrType,
|
|
||||||
toShaderRecord uniforms unifType,
|
|
||||||
toShaderRecord varyings EmptyRecordN
|
|
||||||
]
|
|
||||||
|
|
||||||
return $
|
|
||||||
exists [attrVar, unifVar] $
|
|
||||||
CEqual region Shader shaderType expected
|
|
||||||
|
|
||||||
toShaderRecord :: Map.Map Name.Name Shader.Type -> Type -> Type
|
|
||||||
toShaderRecord types baseRecType =
|
|
||||||
if Map.null types
|
|
||||||
then baseRecType
|
|
||||||
else RecordN (Map.map glToType types) baseRecType
|
|
||||||
|
|
||||||
glToType :: Shader.Type -> Type
|
|
||||||
glToType glType =
|
|
||||||
case glType of
|
|
||||||
Shader.V2 -> Type.vec2
|
|
||||||
Shader.V3 -> Type.vec3
|
|
||||||
Shader.V4 -> Type.vec4
|
|
||||||
Shader.M4 -> Type.mat4
|
|
||||||
Shader.Int -> Type.int
|
|
||||||
Shader.Float -> Type.float
|
|
||||||
Shader.Texture -> Type.texture
|
|
||||||
|
|
||||||
-- CONSTRAIN DESTRUCTURES
|
-- CONSTRAIN DESTRUCTURES
|
||||||
|
|
||||||
constrainDestruct :: RTV -> A.Region -> Can.Pattern -> Can.Expr -> Constraint -> IO Constraint
|
constrainDestruct :: RTV -> A.Region -> Can.Pattern -> Can.Expr -> Constraint -> IO Constraint
|
||||||
|
@ -9,7 +9,7 @@ where
|
|||||||
import qualified AST.Canonical as Can
|
import qualified AST.Canonical as Can
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Type as E
|
import qualified Reporting.Error.Type as E
|
||||||
import qualified Type.Constrain.Expression as Expr
|
import qualified Type.Constrain.Expression as Expr
|
||||||
|
@ -13,7 +13,7 @@ import Control.Monad (foldM)
|
|||||||
import qualified Data.Index as Index
|
import qualified Data.Index as Index
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Type as E
|
import qualified Reporting.Error.Type as E
|
||||||
import qualified Type.Instantiate as Instantiate
|
import qualified Type.Instantiate as Instantiate
|
||||||
|
@ -22,7 +22,7 @@ import qualified Data.Bag as Bag
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
import qualified Reporting.Render.Type as RT
|
import qualified Reporting.Render.Type as RT
|
||||||
import qualified Reporting.Render.Type.Localizer as L
|
import qualified Reporting.Render.Type.Localizer as L
|
||||||
|
@ -22,11 +22,6 @@ module Type.Type
|
|||||||
string,
|
string,
|
||||||
bool,
|
bool,
|
||||||
never,
|
never,
|
||||||
vec2,
|
|
||||||
vec3,
|
|
||||||
vec4,
|
|
||||||
mat4,
|
|
||||||
texture,
|
|
||||||
mkFlexVar,
|
mkFlexVar,
|
||||||
mkFlexNumber,
|
mkFlexNumber,
|
||||||
unnamedFlexVar,
|
unnamedFlexVar,
|
||||||
@ -46,7 +41,7 @@ import Data.Foldable (foldrM)
|
|||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import Data.Word (Word32)
|
import Data.Word (Word32)
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting.Annotation as A
|
import qualified Reporting.Annotation as A
|
||||||
import qualified Reporting.Error.Type as E
|
import qualified Reporting.Error.Type as E
|
||||||
import qualified Type.Error as ET
|
import qualified Type.Error as ET
|
||||||
@ -194,28 +189,6 @@ bool = AppN ModuleName.basics "Bool" []
|
|||||||
never :: Type
|
never :: Type
|
||||||
never = AppN ModuleName.basics "Never" []
|
never = AppN ModuleName.basics "Never" []
|
||||||
|
|
||||||
-- WEBGL TYPES
|
|
||||||
|
|
||||||
{-# NOINLINE vec2 #-}
|
|
||||||
vec2 :: Type
|
|
||||||
vec2 = AppN ModuleName.vector2 "Vec2" []
|
|
||||||
|
|
||||||
{-# NOINLINE vec3 #-}
|
|
||||||
vec3 :: Type
|
|
||||||
vec3 = AppN ModuleName.vector3 "Vec3" []
|
|
||||||
|
|
||||||
{-# NOINLINE vec4 #-}
|
|
||||||
vec4 :: Type
|
|
||||||
vec4 = AppN ModuleName.vector4 "Vec4" []
|
|
||||||
|
|
||||||
{-# NOINLINE mat4 #-}
|
|
||||||
mat4 :: Type
|
|
||||||
mat4 = AppN ModuleName.matrix4 "Mat4" []
|
|
||||||
|
|
||||||
{-# NOINLINE texture #-}
|
|
||||||
texture :: Type
|
|
||||||
texture = AppN ModuleName.texture "Texture" []
|
|
||||||
|
|
||||||
-- MAKE FLEX VARIABLES
|
-- MAKE FLEX VARIABLES
|
||||||
|
|
||||||
mkFlexVar :: IO Variable
|
mkFlexVar :: IO Variable
|
||||||
|
@ -10,7 +10,7 @@ where
|
|||||||
|
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
import qualified Data.Name as Name
|
import qualified Data.Name as Name
|
||||||
import qualified Elm.ModuleName as ModuleName
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Type.Error as Error
|
import qualified Type.Error as Error
|
||||||
import qualified Type.Occurs as Occurs
|
import qualified Type.Occurs as Occurs
|
||||||
import Type.Type as Type
|
import Type.Type as Type
|
||||||
|
34
gren.cabal
34
gren.cabal
@ -82,24 +82,24 @@ Executable gren
|
|||||||
Reporting.Task
|
Reporting.Task
|
||||||
Directories
|
Directories
|
||||||
|
|
||||||
-- Elm things
|
-- Gren things
|
||||||
Elm.Outline
|
Gren.Outline
|
||||||
Elm.Details
|
Gren.Details
|
||||||
--
|
--
|
||||||
Elm.Compiler.Imports
|
Gren.Compiler.Imports
|
||||||
Elm.Compiler.Type
|
Gren.Compiler.Type
|
||||||
Elm.Compiler.Type.Extract
|
Gren.Compiler.Type.Extract
|
||||||
Elm.Constraint
|
Gren.Constraint
|
||||||
Elm.Docs
|
Gren.Docs
|
||||||
Elm.Float
|
Gren.Float
|
||||||
Elm.Interface
|
Gren.Interface
|
||||||
Elm.Kernel
|
Gren.Kernel
|
||||||
Elm.Licenses
|
Gren.Licenses
|
||||||
Elm.Magnitude
|
Gren.Magnitude
|
||||||
Elm.ModuleName
|
Gren.ModuleName
|
||||||
Elm.Package
|
Gren.Package
|
||||||
Elm.String
|
Gren.String
|
||||||
Elm.Version
|
Gren.Version
|
||||||
|
|
||||||
-- data structures
|
-- data structures
|
||||||
Data.Bag
|
Data.Bag
|
||||||
|
@ -34,8 +34,8 @@ where
|
|||||||
|
|
||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
import qualified Elm.Version as V
|
|
||||||
import GHC.IO.Encoding (setLocaleEncoding, utf8)
|
import GHC.IO.Encoding (setLocaleEncoding, utf8)
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified System.Directory as Dir
|
import qualified System.Directory as Dir
|
||||||
import qualified System.Environment as Env
|
import qualified System.Environment as Env
|
||||||
import qualified System.Exit as Exit
|
import qualified System.Exit as Exit
|
||||||
@ -273,7 +273,7 @@ require5 func a b c d e =
|
|||||||
-- file names:
|
-- file names:
|
||||||
--
|
--
|
||||||
-- suggestFiles [] -- suggests any file
|
-- suggestFiles [] -- suggests any file
|
||||||
-- suggestFiles ["elm"] -- suggests only .elm files
|
-- suggestFiles ["gren"] -- suggests only .gren files
|
||||||
-- suggestFiles ["js","html"] -- suggests only .js and .html files
|
-- suggestFiles ["js","html"] -- suggests only .js and .html files
|
||||||
--
|
--
|
||||||
-- Notice that you can limit the suggestion by the file extension! If you need
|
-- Notice that you can limit the suggestion by the file extension! If you need
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
module Terminal.Helpers
|
module Terminal.Helpers
|
||||||
( version,
|
( version,
|
||||||
elmFile,
|
grenFile,
|
||||||
package,
|
package,
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
@ -10,8 +10,8 @@ where
|
|||||||
import qualified Data.ByteString.UTF8 as BS_UTF8
|
import qualified Data.ByteString.UTF8 as BS_UTF8
|
||||||
import qualified Data.Char as Char
|
import qualified Data.Char as Char
|
||||||
import qualified Data.Utf8 as Utf8
|
import qualified Data.Utf8 as Utf8
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Parse.Primitives as P
|
import qualified Parse.Primitives as P
|
||||||
import qualified System.FilePath as FP
|
import qualified System.FilePath as FP
|
||||||
import Terminal (Parser (..))
|
import Terminal (Parser (..))
|
||||||
@ -50,27 +50,27 @@ exampleVersions chars =
|
|||||||
_ -> ["1.0.0", "2.0.3"]
|
_ -> ["1.0.0", "2.0.3"]
|
||||||
else ["1.0.0", "2.0.3"]
|
else ["1.0.0", "2.0.3"]
|
||||||
|
|
||||||
-- ELM FILE
|
-- GREN FILE
|
||||||
|
|
||||||
elmFile :: Parser FilePath
|
grenFile :: Parser FilePath
|
||||||
elmFile =
|
grenFile =
|
||||||
Parser
|
Parser
|
||||||
{ _singular = "elm file",
|
{ _singular = "gren file",
|
||||||
_plural = "elm files",
|
_plural = "gren files",
|
||||||
_parser = parseElmFile,
|
_parser = parseGrenFile,
|
||||||
_suggest = \_ -> return [],
|
_suggest = \_ -> return [],
|
||||||
_examples = exampleElmFiles
|
_examples = exampleGrenFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
parseElmFile :: String -> Maybe FilePath
|
parseGrenFile :: String -> Maybe FilePath
|
||||||
parseElmFile chars =
|
parseGrenFile chars =
|
||||||
if FP.takeExtension chars == ".elm"
|
if FP.takeExtension chars == ".gren"
|
||||||
then Just chars
|
then Just chars
|
||||||
else Nothing
|
else Nothing
|
||||||
|
|
||||||
exampleElmFiles :: String -> IO [String]
|
exampleGrenFiles :: String -> IO [String]
|
||||||
exampleElmFiles _ =
|
exampleGrenFiles _ =
|
||||||
return ["Main.elm", "src/Main.elm"]
|
return ["Main.gren", "src/Main.gren"]
|
||||||
|
|
||||||
-- PACKAGE
|
-- PACKAGE
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@ import qualified Data.NonEmptyList as NE
|
|||||||
import qualified Deps.Diff as Diff
|
import qualified Deps.Diff as Diff
|
||||||
import qualified Deps.Package as Package
|
import qualified Deps.Package as Package
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Details as Details
|
import qualified Gren.Details as Details
|
||||||
import qualified Elm.Docs as Docs
|
import qualified Gren.Docs as Docs
|
||||||
import qualified Elm.Magnitude as M
|
import qualified Gren.Magnitude as M
|
||||||
import qualified Elm.Outline as Outline
|
import qualified Gren.Outline as Outline
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
import Reporting.Doc ((<+>))
|
import Reporting.Doc ((<+>))
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
@ -86,10 +86,10 @@ checkNewPackage root outline@(Outline.PkgOutline _ _ _ version _ _ _ _) =
|
|||||||
do
|
do
|
||||||
putStrLn Exit.newPackageOverview
|
putStrLn Exit.newPackageOverview
|
||||||
if version == V.one
|
if version == V.one
|
||||||
then putStrLn "The version number in elm.json is correct so you are all set!"
|
then putStrLn "The version number in gren.json is correct so you are all set!"
|
||||||
else
|
else
|
||||||
changeVersion root outline V.one $
|
changeVersion root outline V.one $
|
||||||
"It looks like the version in elm.json has been changed though!\n\
|
"It looks like the version in gren.json has been changed though!\n\
|
||||||
\Would you like me to change it back to "
|
\Would you like me to change it back to "
|
||||||
<> D.fromVersion V.one
|
<> D.fromVersion V.one
|
||||||
<> "? [Y/n] "
|
<> "? [Y/n] "
|
||||||
@ -113,13 +113,13 @@ suggestVersion (Env root cache outline@(Outline.PkgOutline pkg _ _ vsn _ _ _ _))
|
|||||||
new = D.fromVersion newVersion
|
new = D.fromVersion newVersion
|
||||||
mag = D.fromChars $ M.toChars (Diff.toMagnitude changes)
|
mag = D.fromChars $ M.toChars (Diff.toMagnitude changes)
|
||||||
in "Based on your new API, this should be a" <+> D.green mag <+> "change (" <> old <> " => " <> new <> ")\n"
|
in "Based on your new API, this should be a" <+> D.green mag <+> "change (" <> old <> " => " <> new <> ")\n"
|
||||||
<> "Bail out of this command and run 'elm diff' for a full explanation.\n"
|
<> "Bail out of this command and run 'gren diff' for a full explanation.\n"
|
||||||
<> "\n"
|
<> "\n"
|
||||||
<> "Should I perform the update ("
|
<> "Should I perform the update ("
|
||||||
<> old
|
<> old
|
||||||
<> " => "
|
<> " => "
|
||||||
<> new
|
<> new
|
||||||
<> ") in elm.json? [Y/n] "
|
<> ") in gren.json? [Y/n] "
|
||||||
|
|
||||||
generateDocs :: FilePath -> Outline.PkgOutline -> Task.Task Exit.Bump Docs.Documentation
|
generateDocs :: FilePath -> Outline.PkgOutline -> Task.Task Exit.Bump Docs.Documentation
|
||||||
generateDocs root (Outline.PkgOutline _ _ _ _ exposed _ _ _) =
|
generateDocs root (Outline.PkgOutline _ _ _ _ exposed _ _ _) =
|
||||||
|
@ -18,13 +18,13 @@ import Deps.Diff (Changes (..), ModuleChanges (..), PackageChanges (..))
|
|||||||
import qualified Deps.Diff as DD
|
import qualified Deps.Diff as DD
|
||||||
import qualified Deps.Package as Package
|
import qualified Deps.Package as Package
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Compiler.Type as Type
|
import qualified Gren.Compiler.Type as Type
|
||||||
import qualified Elm.Details as Details
|
import qualified Gren.Details as Details
|
||||||
import qualified Elm.Docs as Docs
|
import qualified Gren.Docs as Docs
|
||||||
import qualified Elm.Magnitude as M
|
import qualified Gren.Magnitude as M
|
||||||
import qualified Elm.Outline as Outline
|
import qualified Gren.Outline as Outline
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
import Reporting.Doc ((<+>))
|
import Reporting.Doc ((<+>))
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
|
@ -8,10 +8,10 @@ where
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.NonEmptyList as NE
|
import qualified Data.NonEmptyList as NE
|
||||||
import qualified Deps.Solver as Solver
|
import qualified Deps.Solver as Solver
|
||||||
import qualified Elm.Constraint as Con
|
import qualified Gren.Constraint as Con
|
||||||
import qualified Elm.Outline as Outline
|
import qualified Gren.Outline as Outline
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
import qualified Reporting.Exit as Exit
|
import qualified Reporting.Exit as Exit
|
||||||
@ -24,7 +24,7 @@ run :: () -> () -> IO ()
|
|||||||
run () () =
|
run () () =
|
||||||
Reporting.attempt Exit.initToReport $
|
Reporting.attempt Exit.initToReport $
|
||||||
do
|
do
|
||||||
exists <- Dir.doesFileExist "elm.json"
|
exists <- Dir.doesFileExist "gren.json"
|
||||||
if exists
|
if exists
|
||||||
then return (Left Exit.InitAlreadyExists)
|
then return (Left Exit.InitAlreadyExists)
|
||||||
else do
|
else do
|
||||||
@ -40,13 +40,13 @@ question =
|
|||||||
D.stack
|
D.stack
|
||||||
[ D.fillSep
|
[ D.fillSep
|
||||||
[ "Hello!",
|
[ "Hello!",
|
||||||
"Elm",
|
"Gren",
|
||||||
"projects",
|
"projects",
|
||||||
"always",
|
"always",
|
||||||
"start",
|
"start",
|
||||||
"with",
|
"with",
|
||||||
"an",
|
"an",
|
||||||
D.green "elm.json",
|
D.green "gren.json",
|
||||||
"file.",
|
"file.",
|
||||||
"I",
|
"I",
|
||||||
"can",
|
"can",
|
||||||
@ -54,7 +54,7 @@ question =
|
|||||||
"them!"
|
"them!"
|
||||||
],
|
],
|
||||||
D.reflow
|
D.reflow
|
||||||
"Now you may be wondering, what will be in this file? How do I add Elm files to\
|
"Now you may be wondering, what will be in this file? How do I add Gren files to\
|
||||||
\ my project? How do I see it in the browser? How will my code grow? Do I need\
|
\ my project? How do I see it in the browser? How will my code grow? Do I need\
|
||||||
\ more directories? What about tests? Etc.",
|
\ more directories? What about tests? Etc.",
|
||||||
D.fillSep
|
D.fillSep
|
||||||
@ -66,7 +66,7 @@ question =
|
|||||||
"the",
|
"the",
|
||||||
"answers!"
|
"answers!"
|
||||||
],
|
],
|
||||||
"Knowing all that, would you like me to create an elm.json file now? [Y/n]: "
|
"Knowing all that, would you like me to create an gren.json file now? [Y/n]: "
|
||||||
]
|
]
|
||||||
|
|
||||||
-- INIT
|
-- INIT
|
||||||
|
@ -12,11 +12,11 @@ import qualified Data.Map as Map
|
|||||||
import qualified Data.Map.Merge.Strict as Map
|
import qualified Data.Map.Merge.Strict as Map
|
||||||
import qualified Deps.Solver as Solver
|
import qualified Deps.Solver as Solver
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Constraint as C
|
import qualified Gren.Constraint as C
|
||||||
import qualified Elm.Details as Details
|
import qualified Gren.Details as Details
|
||||||
import qualified Elm.Outline as Outline
|
import qualified Gren.Outline as Outline
|
||||||
import qualified Elm.Package as Pkg
|
import qualified Gren.Package as Pkg
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
import Reporting.Doc ((<+>))
|
import Reporting.Doc ((<+>))
|
||||||
import qualified Reporting.Doc as D
|
import qualified Reporting.Doc as D
|
||||||
@ -41,8 +41,8 @@ run args () =
|
|||||||
case args of
|
case args of
|
||||||
NoArgs ->
|
NoArgs ->
|
||||||
do
|
do
|
||||||
elmHome <- Dirs.getGrenHome
|
grenHome <- Dirs.getGrenHome
|
||||||
return (Left (Exit.InstallNoArgs elmHome))
|
return (Left (Exit.InstallNoArgs grenHome))
|
||||||
Install pkg ->
|
Install pkg ->
|
||||||
Task.run $
|
Task.run $
|
||||||
do
|
do
|
||||||
@ -82,7 +82,7 @@ attemptChanges root env oldOutline toChars changes =
|
|||||||
"it",
|
"it",
|
||||||
"in",
|
"in",
|
||||||
"your",
|
"your",
|
||||||
"elm.json",
|
"gren.json",
|
||||||
"file,",
|
"file,",
|
||||||
"but",
|
"but",
|
||||||
"in",
|
"in",
|
||||||
@ -114,7 +114,7 @@ attemptChanges root env oldOutline toChars changes =
|
|||||||
"it",
|
"it",
|
||||||
"in",
|
"in",
|
||||||
"your",
|
"your",
|
||||||
"elm.json",
|
"gren.json",
|
||||||
"file,",
|
"file,",
|
||||||
"but",
|
"but",
|
||||||
"in",
|
"in",
|
||||||
@ -144,7 +144,7 @@ attemptChanges root env oldOutline toChars changes =
|
|||||||
[ "Here is my plan:",
|
[ "Here is my plan:",
|
||||||
viewChangeDocs changeDocs,
|
viewChangeDocs changeDocs,
|
||||||
"",
|
"",
|
||||||
"Would you like me to update your elm.json accordingly? [Y/n]: "
|
"Would you like me to update your gren.json accordingly? [Y/n]: "
|
||||||
]
|
]
|
||||||
|
|
||||||
attemptChangesHelp :: FilePath -> Solver.Env -> Outline.Outline -> Outline.Outline -> D.Doc -> Task ()
|
attemptChangesHelp :: FilePath -> Solver.Env -> Outline.Outline -> Outline.Outline -> D.Doc -> Task ()
|
||||||
|
@ -8,7 +8,7 @@ where
|
|||||||
import qualified Bump
|
import qualified Bump
|
||||||
import qualified Data.List as List
|
import qualified Data.List as List
|
||||||
import qualified Diff
|
import qualified Diff
|
||||||
import qualified Elm.Version as V
|
import qualified Gren.Version as V
|
||||||
import qualified Init
|
import qualified Init
|
||||||
import qualified Install
|
import qualified Install
|
||||||
import qualified Make
|
import qualified Make
|
||||||
@ -45,14 +45,14 @@ intro =
|
|||||||
"for",
|
"for",
|
||||||
"trying",
|
"trying",
|
||||||
"out",
|
"out",
|
||||||
P.green "Elm",
|
P.green "Gren",
|
||||||
P.green (P.text (V.toChars V.compiler)) <> ".",
|
P.green (P.text (V.toChars V.compiler)) <> ".",
|
||||||
"I hope you like it!"
|
"I hope you like it!"
|
||||||
],
|
],
|
||||||
"",
|
"",
|
||||||
P.black "-------------------------------------------------------------------------------",
|
P.black "-------------------------------------------------------------------------------",
|
||||||
P.black "I highly recommend working through <https://guide.elm-lang.org> to get started.",
|
P.black "I highly recommend working through <https://guide.gren-lang.org> to get started.",
|
||||||
P.black "It teaches many important concepts, including how to use `elm` in the terminal.",
|
P.black "It teaches many important concepts, including how to use `gren` in the terminal.",
|
||||||
P.black "-------------------------------------------------------------------------------"
|
P.black "-------------------------------------------------------------------------------"
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ outro =
|
|||||||
P.fillSep $
|
P.fillSep $
|
||||||
map P.text $
|
map P.text $
|
||||||
words
|
words
|
||||||
"Be sure to ask on the Elm slack if you run into trouble! Folks are friendly and\
|
"Be sure to ask on the Gren slack if you run into trouble! Folks are friendly and\
|
||||||
\ happy to help out. They hang out there because it is fun, so be kind to get the\
|
\ happy to help out. They hang out there because it is fun, so be kind to get the\
|
||||||
\ best results!"
|
\ best results!"
|
||||||
|
|
||||||
@ -70,16 +70,16 @@ outro =
|
|||||||
init :: Terminal.Command
|
init :: Terminal.Command
|
||||||
init =
|
init =
|
||||||
let summary =
|
let summary =
|
||||||
"Start an Elm project. It creates a starter elm.json file and\
|
"Start an Gren project. It creates a starter gren.json file and\
|
||||||
\ provides a link explaining what to do from there."
|
\ provides a link explaining what to do from there."
|
||||||
|
|
||||||
details =
|
details =
|
||||||
"The `init` command helps start Elm projects:"
|
"The `init` command helps start Gren projects:"
|
||||||
|
|
||||||
example =
|
example =
|
||||||
reflow
|
reflow
|
||||||
"It will ask permission to create an elm.json file, the one thing common\
|
"It will ask permission to create an gren.json file, the one thing common\
|
||||||
\ to all Elm projects. It also provides a link explaining what to do from there."
|
\ to all Gren projects. It also provides a link explaining what to do from there."
|
||||||
in Terminal.Command "init" (Common summary) details example noArgs noFlags Init.run
|
in Terminal.Command "init" (Common summary) details example noArgs noFlags Init.run
|
||||||
|
|
||||||
-- REPL
|
-- REPL
|
||||||
@ -87,7 +87,7 @@ init =
|
|||||||
repl :: Terminal.Command
|
repl :: Terminal.Command
|
||||||
repl =
|
repl =
|
||||||
let summary =
|
let summary =
|
||||||
"Open up an interactive programming session. Type in Elm expressions\
|
"Open up an interactive programming session. Type in Gren expressions\
|
||||||
\ like (2 + 2) or (String.length \"test\") and see if they equal four!"
|
\ like (2 + 2) or (String.length \"test\") and see if they equal four!"
|
||||||
|
|
||||||
details =
|
details =
|
||||||
@ -95,7 +95,7 @@ repl =
|
|||||||
|
|
||||||
example =
|
example =
|
||||||
reflow
|
reflow
|
||||||
"Start working through <https://guide.elm-lang.org> to learn how to use this!\
|
"Start working through <https://guide.gren-lang.org> to learn how to use this!\
|
||||||
\ It has a whole chapter that uses the REPL for everything, so that is probably\
|
\ It has a whole chapter that uses the REPL for everything, so that is probably\
|
||||||
\ the quickest way to get started."
|
\ the quickest way to get started."
|
||||||
|
|
||||||
@ -120,15 +120,15 @@ interpreter =
|
|||||||
make :: Terminal.Command
|
make :: Terminal.Command
|
||||||
make =
|
make =
|
||||||
let details =
|
let details =
|
||||||
"The `make` command compiles Elm code into JS or HTML:"
|
"The `make` command compiles Gren code into JS or HTML:"
|
||||||
|
|
||||||
example =
|
example =
|
||||||
stack
|
stack
|
||||||
[ reflow
|
[ reflow
|
||||||
"For example:",
|
"For example:",
|
||||||
P.indent 4 $ P.green "elm make src/Main.elm",
|
P.indent 4 $ P.green "gren make src/Main.gren",
|
||||||
reflow
|
reflow
|
||||||
"This tries to compile an Elm file named src/Main.elm, generating an index.html\
|
"This tries to compile an Gren file named src/Main.gren, generating an index.html\
|
||||||
\ file if possible."
|
\ file if possible."
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -136,17 +136,17 @@ make =
|
|||||||
flags Make.Flags
|
flags Make.Flags
|
||||||
|-- onOff "debug" "Turn on the time-travelling debugger. It allows you to rewind and replay events. The events can be imported/exported into a file, which makes for very precise bug reports!"
|
|-- onOff "debug" "Turn on the time-travelling debugger. It allows you to rewind and replay events. The events can be imported/exported into a file, which makes for very precise bug reports!"
|
||||||
|-- onOff "optimize" "Turn on optimizations to make code smaller and faster. For example, the compiler renames record fields to be as short as possible and unboxes values to reduce allocation."
|
|-- onOff "optimize" "Turn on optimizations to make code smaller and faster. For example, the compiler renames record fields to be as short as possible and unboxes values to reduce allocation."
|
||||||
|-- flag "output" Make.output "Specify the name of the resulting JS file. For example --output=assets/elm.js to generate the JS at assets/elm.js or --output=/dev/null to generate no output at all!"
|
|-- flag "output" Make.output "Specify the name of the resulting JS file. For example --output=assets/gren.js to generate the JS at assets/gren.js or --output=/dev/null to generate no output at all!"
|
||||||
|-- flag "report" Make.reportType "You can say --report=json to get error messages as JSON. This is only really useful if you are an editor plugin. Humans should avoid it!"
|
|-- flag "report" Make.reportType "You can say --report=json to get error messages as JSON. This is only really useful if you are an editor plugin. Humans should avoid it!"
|
||||||
|-- flag "docs" Make.docsFile "Generate a JSON file of documentation for a package. Eventually it will be possible to preview docs with `reactor` because it is quite hard to deal with these JSON files directly."
|
|-- flag "docs" Make.docsFile "Generate a JSON file of documentation for a package. Eventually it will be possible to preview docs with `reactor` because it is quite hard to deal with these JSON files directly."
|
||||||
in Terminal.Command "make" Uncommon details example (zeroOrMore elmFile) makeFlags Make.run
|
in Terminal.Command "make" Uncommon details example (zeroOrMore grenFile) makeFlags Make.run
|
||||||
|
|
||||||
-- INSTALL
|
-- INSTALL
|
||||||
|
|
||||||
install :: Terminal.Command
|
install :: Terminal.Command
|
||||||
install =
|
install =
|
||||||
let details =
|
let details =
|
||||||
"The `install` command fetches packages from <https://package.elm-lang.org> for\
|
"The `install` command fetches packages from <https://package.gren-lang.org> for\
|
||||||
\ use in your project:"
|
\ use in your project:"
|
||||||
|
|
||||||
example =
|
example =
|
||||||
@ -156,8 +156,8 @@ install =
|
|||||||
P.indent 4 $
|
P.indent 4 $
|
||||||
P.green $
|
P.green $
|
||||||
P.vcat $
|
P.vcat $
|
||||||
[ "elm install elm/http",
|
[ "gren install gren/http",
|
||||||
"elm install elm/json"
|
"gren install gren/json"
|
||||||
],
|
],
|
||||||
reflow
|
reflow
|
||||||
"Notice that you must say the AUTHOR name and PROJECT name! After running those\
|
"Notice that you must say the AUTHOR name and PROJECT name! After running those\
|
||||||
@ -179,18 +179,18 @@ install =
|
|||||||
publish :: Terminal.Command
|
publish :: Terminal.Command
|
||||||
publish =
|
publish =
|
||||||
let details =
|
let details =
|
||||||
"The `publish` command publishes your package on <https://package.elm-lang.org>\
|
"The `publish` command publishes your package on <https://package.gren-lang.org>\
|
||||||
\ so that anyone in the Elm community can use it."
|
\ so that anyone in the Gren community can use it."
|
||||||
|
|
||||||
example =
|
example =
|
||||||
stack
|
stack
|
||||||
[ reflow
|
[ reflow
|
||||||
"Think hard if you are ready to publish NEW packages though!",
|
"Think hard if you are ready to publish NEW packages though!",
|
||||||
reflow
|
reflow
|
||||||
"Part of what makes Elm great is the packages ecosystem. The fact that\
|
"Part of what makes Gren great is the packages ecosystem. The fact that\
|
||||||
\ there is usually one option (usually very well done) makes it way\
|
\ there is usually one option (usually very well done) makes it way\
|
||||||
\ easier to pick packages and become productive. So having a million\
|
\ easier to pick packages and become productive. So having a million\
|
||||||
\ packages would be a failure in Elm. We do not need twenty of\
|
\ packages would be a failure in Gren. We do not need twenty of\
|
||||||
\ everything, all coded in a single weekend.",
|
\ everything, all coded in a single weekend.",
|
||||||
reflow
|
reflow
|
||||||
"So as community members gain wisdom through experience, we want\
|
"So as community members gain wisdom through experience, we want\
|
||||||
@ -202,7 +202,7 @@ publish =
|
|||||||
\ it ends up as an experiment on GitHub only. Point is, try to be\
|
\ it ends up as an experiment on GitHub only. Point is, try to be\
|
||||||
\ respectful of the community and package ecosystem!",
|
\ respectful of the community and package ecosystem!",
|
||||||
reflow
|
reflow
|
||||||
"Check out <https://package.elm-lang.org/help/design-guidelines> for guidance on how to create great packages!"
|
"Check out <https://package.gren-lang.org/help/design-guidelines> for guidance on how to create great packages!"
|
||||||
]
|
]
|
||||||
in Terminal.Command "publish" Uncommon details example noArgs noFlags Publish.run
|
in Terminal.Command "publish" Uncommon details example noArgs noFlags Publish.run
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ bump =
|
|||||||
"Say you just published version 1.0.0, but then decided to remove a function.\
|
"Say you just published version 1.0.0, but then decided to remove a function.\
|
||||||
\ I will compare the published API to what you have locally, figure out that\
|
\ I will compare the published API to what you have locally, figure out that\
|
||||||
\ it is a MAJOR change, and bump your version number to 2.0.0. I do this with\
|
\ it is a MAJOR change, and bump your version number to 2.0.0. I do this with\
|
||||||
\ all packages, so there cannot be MAJOR changes hiding in PATCH releases in Elm!"
|
\ all packages, so there cannot be MAJOR changes hiding in PATCH releases in Gren!"
|
||||||
in Terminal.Command "bump" Uncommon details example noArgs noFlags Bump.run
|
in Terminal.Command "bump" Uncommon details example noArgs noFlags Bump.run
|
||||||
|
|
||||||
-- DIFF
|
-- DIFF
|
||||||
@ -233,7 +233,7 @@ diff =
|
|||||||
[ reflow
|
[ reflow
|
||||||
"For example, to see what changed in the HTML package between\
|
"For example, to see what changed in the HTML package between\
|
||||||
\ versions 1.0.0 and 2.0.0, you can say:",
|
\ versions 1.0.0 and 2.0.0, you can say:",
|
||||||
P.indent 4 $ P.green $ "elm diff elm/html 1.0.0 2.0.0",
|
P.indent 4 $ P.green $ "gren diff gren/html 1.0.0 2.0.0",
|
||||||
reflow
|
reflow
|
||||||
"Sometimes a MAJOR change is not actually very big, so\
|
"Sometimes a MAJOR change is not actually very big, so\
|
||||||
\ this can help you plan your upgrade timelines."
|
\ this can help you plan your upgrade timelines."
|
||||||
|
@ -18,11 +18,11 @@ import qualified Data.ByteString.Builder as B
|
|||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
import qualified Data.NonEmptyList as NE
|
import qualified Data.NonEmptyList as NE
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Details as Details
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified File
|
import qualified File
|
||||||
import qualified Generate
|
import qualified Generate
|
||||||
import qualified Generate.Html as Html
|
import qualified Generate.Html as Html
|
||||||
|
import qualified Gren.Details as Details
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
import qualified Reporting.Exit as Exit
|
import qualified Reporting.Exit as Exit
|
||||||
import qualified Reporting.Task as Task
|
import qualified Reporting.Task as Task
|
||||||
@ -90,7 +90,7 @@ runHelp root paths style (Flags debug optimize maybeOutput _ maybeDocs) =
|
|||||||
name : names ->
|
name : names ->
|
||||||
do
|
do
|
||||||
builder <- toBuilder root details desiredMode artifacts
|
builder <- toBuilder root details desiredMode artifacts
|
||||||
generate style "elm.js" builder (NE.List name names)
|
generate style "gren.js" builder (NE.List name names)
|
||||||
Just DevNull ->
|
Just DevNull ->
|
||||||
return ()
|
return ()
|
||||||
Just (JS target) ->
|
Just (JS target) ->
|
||||||
@ -239,7 +239,7 @@ output =
|
|||||||
_plural = "output files",
|
_plural = "output files",
|
||||||
_parser = parseOutput,
|
_parser = parseOutput,
|
||||||
_suggest = \_ -> return [],
|
_suggest = \_ -> return [],
|
||||||
_examples = \_ -> return ["elm.js", "index.html", "/dev/null"]
|
_examples = \_ -> return ["gren.js", "index.html", "/dev/null"]
|
||||||
}
|
}
|
||||||
|
|
||||||
parseOutput :: String -> Maybe Output
|
parseOutput :: String -> Maybe Output
|
||||||
|
@ -14,14 +14,14 @@ import qualified Data.NonEmptyList as NE
|
|||||||
import qualified Deps.Diff as Diff
|
import qualified Deps.Diff as Diff
|
||||||
import qualified Deps.Package as Package
|
import qualified Deps.Package as Package
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Details as Details
|
|
||||||
import qualified Elm.Docs as Docs
|
|
||||||
import qualified Elm.Magnitude as M
|
|
||||||
import qualified Elm.Outline as Outline
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified Elm.Version as V
|
|
||||||
import qualified File
|
import qualified File
|
||||||
import qualified Git
|
import qualified Git
|
||||||
|
import qualified Gren.Details as Details
|
||||||
|
import qualified Gren.Docs as Docs
|
||||||
|
import qualified Gren.Magnitude as M
|
||||||
|
import qualified Gren.Outline as Outline
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified Json.String as Json
|
import qualified Json.String as Json
|
||||||
import qualified Reporting
|
import qualified Reporting
|
||||||
import Reporting.Doc ((<+>))
|
import Reporting.Doc ((<+>))
|
||||||
|
@ -34,14 +34,14 @@ import qualified Data.Map as Map
|
|||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
import qualified Data.Name as N
|
import qualified Data.Name as N
|
||||||
import qualified Directories as Dirs
|
import qualified Directories as Dirs
|
||||||
import qualified Elm.Constraint as C
|
|
||||||
import qualified Elm.Details as Details
|
|
||||||
import qualified Elm.Licenses as Licenses
|
|
||||||
import qualified Elm.ModuleName as ModuleName
|
|
||||||
import qualified Elm.Outline as Outline
|
|
||||||
import qualified Elm.Package as Pkg
|
|
||||||
import qualified Elm.Version as V
|
|
||||||
import qualified Generate
|
import qualified Generate
|
||||||
|
import qualified Gren.Constraint as C
|
||||||
|
import qualified Gren.Details as Details
|
||||||
|
import qualified Gren.Licenses as Licenses
|
||||||
|
import qualified Gren.ModuleName as ModuleName
|
||||||
|
import qualified Gren.Outline as Outline
|
||||||
|
import qualified Gren.Package as Pkg
|
||||||
|
import qualified Gren.Version as V
|
||||||
import qualified Parse.Declaration as PD
|
import qualified Parse.Declaration as PD
|
||||||
import qualified Parse.Expression as PE
|
import qualified Parse.Expression as PE
|
||||||
import qualified Parse.Module as PM
|
import qualified Parse.Module as PM
|
||||||
@ -89,7 +89,7 @@ run () flags =
|
|||||||
printWelcomeMessage :: IO ()
|
printWelcomeMessage :: IO ()
|
||||||
printWelcomeMessage =
|
printWelcomeMessage =
|
||||||
let vsn = V.toChars V.compiler
|
let vsn = V.toChars V.compiler
|
||||||
title = "Elm" <+> D.fromChars vsn
|
title = "Gren" <+> D.fromChars vsn
|
||||||
dashes = replicate (70 - length vsn) '-'
|
dashes = replicate (70 - length vsn) '-'
|
||||||
in D.toAnsi IO.stdout $
|
in D.toAnsi IO.stdout $
|
||||||
D.vcat
|
D.vcat
|
||||||
@ -513,7 +513,7 @@ getRoot =
|
|||||||
(Outline.ExposedList [])
|
(Outline.ExposedList [])
|
||||||
defaultDeps
|
defaultDeps
|
||||||
Map.empty
|
Map.empty
|
||||||
C.defaultElm
|
C.defaultGren
|
||||||
|
|
||||||
return root
|
return root
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user