Skip to content

Commit

Permalink
chore(primer-miso): explicit imports per our style guide
Browse files Browse the repository at this point in the history
Signed-off-by: Drew Hess <[email protected]>
  • Loading branch information
dhess committed Dec 12, 2024
1 parent d86bb45 commit f7dd8cf
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 17 deletions.
2 changes: 1 addition & 1 deletion primer-miso/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Main (main) where

import Foreword

import Language.Javascript.JSaddle.Warp
import Language.Javascript.JSaddle.Warp ( debug )
import Primer.Miso (start)

-- Note that `debug` works with `cabal repl` but not `cabal run`.
Expand Down
105 changes: 98 additions & 7 deletions primer-miso/src/Primer/Miso.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,108 @@ import Data.Tree qualified as Tree
import GHC.Base (error)
import Linear (Metric (norm), R1 (_x), V2 (V2), unangle)
import Linear.Affine ((.+^), (.-.), (.-^))
import Miso hiding (P, node)
import Optics hiding (view)
import Miso (
App (
App,
events,
initialAction,
logLevel,
model,
mountPoint,
subs,
update,
view
),
Effect,
JSM,
LogLevel (Off),
View,
defaultEvents,
div_,
fromTransition,
img_,
onClick,
src_,
style_,
text,
)
import Optics (lensVL, over, to, (%), (.~), (^.), (^..))
import Optics.State.Operators ((?=))
import Primer.App
import Primer.Core hiding (App)
import Primer.App (
NodeSelection (NodeSelection),
NodeType (BodyNode, SigNode),
Prog (progImports),
newProg,
)
import Primer.Core (
Bind' (Bind),
CaseBranch' (CaseBranch),
CaseFallback' (CaseExhaustive, CaseFallback),
Expr' (
APP,
Ann,
Case,
Con,
EmptyHole,
Hole,
LAM,
Lam,
Let,
LetType,
Letrec,
PrimCon,
Var
),
GlobalName (baseName, qualifiedModule),
Kind' (..),
LocalName (unLocalName),
ModuleName,
Pattern (PatCon, PatPrim),
PrimCon (..),
TmVarRef (GlobalVarRef, LocalVarRef),
Type' (..),
mkSimpleModuleName,
typesInExpr,
_exprMetaLens,
_kindMetaLens,
_typeMetaLens,
)
import Primer.Core qualified as Primer
import Primer.Def (Def (..))
import Primer.JSON (CustomJSON (..), PrimerJSON)
import Primer.Miso.Colors
import Primer.Miso.Layout
import Primer.Miso.Util
import Primer.Miso.Colors (
blackPrimary,
bluePrimary,
blueQuaternary,
blueSecondary,
blueTertiary,
greenPrimary,
greySecondary,
redTertiary,
whitePrimary,
yellowPrimary,
yellowTertiary,
)
import Primer.Miso.Layout (
P2,
slHSep,
slHeight,
slVSep,
slWidth,
symmLayout',
)
import Primer.Miso.Util (
ASTDefT (expr, sig),
NodeSelectionT,
TermMeta',
bindingsInExpr,
bindingsInType,
kindsInType,
nodeSelectionType,
startAppWithSavedState,
tcBasicProg,
typeBindingsInExpr,
)
import Primer.Module (Module (moduleDefs, moduleName))
import Primer.Name (Name, unName)

Expand Down
10 changes: 5 additions & 5 deletions primer-miso/src/Primer/Miso/Layout.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ import Foreword hiding (second)

import Control.Arrow (second, (&&&), (***))

import Data.Default
import Data.Tree
import Data.Default (Default (..))
import Data.Tree (Tree (Node, rootLabel))

import Linear
import Linear.Affine
import Linear (V2 (V2), (*^))
import Linear.Affine (Affine ((.+^)), Point (P), origin)

import Optics hiding (Empty)
import Optics (makeLenses, (^.))
import Primer.Miso.Util (P2, unitX, unit_Y)

------------------------------------------------------------
Expand Down
35 changes: 31 additions & 4 deletions primer-miso/src/Primer/Miso/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,38 @@ import Control.Monad.Fresh (MonadFresh (..))
import Data.Aeson (FromJSON, ToJSON)
import Linear (Additive, R1 (_x), R2 (_y), V2, zero)
import Linear.Affine (Point (..), unP)
import Miso
import Optics
import Miso (
App (initialAction, model, subs, update, view),
JSM,
getLocalStorage,
mapSub,
setLocalStorage,
startApp,
(<#),
)
import Optics (
AffineTraversal',
Field1 (_1),
Field2 (_2),
atraversalVL,
lensVL,
(.~),
(^.),
)
import Optics.State.Operators ((<<%=))
import Primer.App
import Primer.Core
import Primer.App (NodeSelection (meta), Prog, progCxt)
import Primer.Core (
Expr' (LAM, Lam, Let, LetType, Letrec),
ID,
Kind' (KType),
LVarName,
Meta,
TyVarName,
Type' (TEmptyHole, TForall, THole, TLet),
TypeCache (..),
TypeCacheBoth (TCBoth, tcChkedAt, tcSynthed),
_type,
)
import Primer.Core.Utils (forgetTypeMetadata)
import Primer.Def (ASTDef (..), astDefExpr)
import Primer.JSON (CustomJSON (..), PrimerJSON)
Expand Down

1 comment on commit f7dd8cf

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Primer benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: f7dd8cf Previous: a416f79 Ratio
typecheck/mapOdd 10: outlier variance 0.06995045896286595 outlier variance 0.018175582990397725 outlier variance 3.85

This comment was automatically generated by workflow using github-action-benchmark.

CC: @dhess

Please sign in to comment.