Skip to content

Commit ded99e8

Browse files
Restyled by fourmolu
1 parent 0014960 commit ded99e8

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

src/swarm-doc/Swarm/Doc/Pedagogy.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ isConsidered c = isUserFunc c && c `S.notMember` ignoredCommands
137137
-- the player did not write it explicitly in their code.
138138
--
139139
-- Also, the code from `run` is not parsed transitively yet.
140-
getCommands :: forall phase.
140+
getCommands ::
141+
forall phase.
141142
( Data (Anchor (ImportPhaseFor phase))
142143
, Data (SwarmType phase)
143144
, Typeable phase

src/swarm-lang/Swarm/Language/LSP.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import Language.LSP.Protocol.Types qualified as LSP
2222
import Language.LSP.Server
2323
import Language.LSP.VFS (VirtualFile (..), virtualFileText)
2424
import Swarm.Failure (SystemFailure (..))
25-
import Swarm.Language.Load (SyntaxWithImports (..))
2625
import Swarm.Language.LSP.Hover qualified as H
2726
import Swarm.Language.LSP.VarUsage qualified as VU
27+
import Swarm.Language.Load (SyntaxWithImports (..))
2828
import Swarm.Language.Parser.Util (getLocRange)
2929
import Swarm.Language.Pipeline (processSource)
3030
import Swarm.Language.Syntax (SrcLoc (..), eraseRaw)

src/swarm-lang/Swarm/Language/Load.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import Swarm.Language.Parser.Core (defaultParserConfig, importLoc)
3333
import Swarm.Language.Syntax (ImportPhaseFor, Phase (..), SwarmType, Syntax)
3434
import Swarm.Language.Syntax.Import hiding (ImportPhase (..))
3535
import Swarm.Language.Syntax.Import qualified as Import
36-
import Swarm.Language.Syntax.Util (Erasable(..), traverseSyntax)
36+
import Swarm.Language.Syntax.Util (Erasable (..), traverseSyntax)
3737
import Swarm.Language.Types (TCtx, UCtx)
3838
import Swarm.Util (readFileMayT)
3939
import Swarm.Util.Graph (findCycle)

src/swarm-lang/Swarm/Language/Parser/Value.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ readValue ty txt = do
5151
-- encountered; we can't read those anyway.
5252
sResolved <- eitherToMaybe $ run . runError @SystemFailure $ resolve' s
5353
-- Now, make sure the resolved term typechecks at the given type.
54-
_ <- eitherToMaybe . runError @ContextualTypeErr $
55-
checkTop Ctx.empty Ctx.empty emptyTDCtx M.empty sResolved ty
54+
_ <-
55+
eitherToMaybe . runError @ContextualTypeErr $
56+
checkTop Ctx.empty Ctx.empty emptyTDCtx M.empty sResolved ty
5657
-- Finally, turn the term into a value.
5758
toValue $ s ^. sTerm
5859

src/swarm-lang/Swarm/Language/Typecheck.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -885,19 +885,19 @@ inferTop ::
885885
Has (Error ContextualTypeErr) sig m =>
886886
TCtx -> ReqCtx -> TDCtx -> SourceMap Resolved -> Syntax Resolved -> m (SyntaxWithImports Typed)
887887
inferTop ctx reqCtx tdCtx srcMap =
888-
fmap (uncurry SyntaxWithImports) .
889-
runTC ctx reqCtx tdCtx Ctx.empty srcMap .
890-
infer
888+
fmap (uncurry SyntaxWithImports)
889+
. runTC ctx reqCtx tdCtx Ctx.empty srcMap
890+
. infer
891891

892892
-- | Top level type checking function.
893893
checkTop ::
894894
Has (Error ContextualTypeErr) sig m =>
895895
TCtx -> ReqCtx -> TDCtx -> SourceMap Resolved -> Syntax Resolved -> Type -> m (SyntaxWithImports Typed)
896896
checkTop ctx reqCtx tdCtx srcMap t =
897-
fmap (uncurry SyntaxWithImports) .
898-
runTC ctx reqCtx tdCtx Ctx.empty srcMap .
899-
check t .
900-
toU
897+
fmap (uncurry SyntaxWithImports)
898+
. runTC ctx reqCtx tdCtx Ctx.empty srcMap
899+
. check t
900+
. toU
901901

902902
-- | Infer the type of a term, returning a type-annotated term.
903903
--

src/swarm-lang/Swarm/Language/Value.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ makeLenses ''Env
178178

179179
-- | Create an environment which is empty except for an initial SourceMap.
180180
envFromSrcMap :: SourceMap Elaborated -> Env
181-
envFromSrcMap srcMap = emptyEnv { _envSourceMap = srcMap }
181+
envFromSrcMap srcMap = emptyEnv {_envSourceMap = srcMap}
182182

183183
emptyEnv :: Env
184184
emptyEnv = Env Ctx.empty Ctx.empty Ctx.empty emptyTDCtx M.empty

src/swarm-tui/Swarm/TUI/Controller.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ validateREPLForm s =
890890
(theType, errSrcLoc) = case readTerm' defaultParserConfig uinput of
891891
Left err ->
892892
let (((_y1, x1), (_y2, x2)), _msg) = showErrorPos err
893-
in (Nothing, Left (SrcLoc Nothing x1 x2))
893+
in (Nothing, Left (SrcLoc Nothing x1 x2))
894894
Right Nothing -> (Nothing, Right ())
895895
Right (Just theTerm) ->
896896
-- Explicitly ignore REPL entries with imports,
@@ -899,15 +899,15 @@ validateREPLForm s =
899899
-- be properly resolved and checked when the
900900
-- user hits enter.
901901
let res = run . runError @SystemFailure $ processTermNoImports uinput theTerm (Just env)
902-
in case res of
903-
Right t -> (Just (t ^. sType), Right ())
904-
Left (DoesNotTypecheck loc _) -> (Nothing, Left loc)
905-
-- Don't signal an error if the REPL entry contained an import
906-
Left (DisallowedImport _) -> (Nothing, Right ())
907-
_ -> (Nothing, Right ())
902+
in case res of
903+
Right t -> (Just (t ^. sType), Right ())
904+
Left (DoesNotTypecheck loc _) -> (Nothing, Left loc)
905+
-- Don't signal an error if the REPL entry contained an import
906+
Left (DisallowedImport _) -> (Nothing, Right ())
907+
_ -> (Nothing, Right ())
908908
in s
909-
& uiGameplay . uiREPL . replValid .~ errSrcLoc
910-
& uiGameplay . uiREPL . replType .~ theType
909+
& uiGameplay . uiREPL . replValid .~ errSrcLoc
910+
& uiGameplay . uiREPL . replType .~ theType
911911
SearchPrompt _ -> s
912912
where
913913
uinput = s ^. uiGameplay . uiREPL . replPromptText

0 commit comments

Comments
 (0)